<commit_before>import os
import mptt
from django.db import models
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.files.storage import FileSystemStorage
from django.core.files.base import File, ContentFile
from django.utils.translation import ugettext_lazy as _
from datetime import datetime, date
from image_filer.utils import EXIF
from sorl.thumbnail import fields as thumbnail_fields
from image_filer.fields import ImageFilerModelImageField, \
    ImageFilerModelFolderField

from managers import FolderManager
from django.db.models.signals import post_init
from django.utils.functional import curry
from django.core.urlresolvers import reverse
import StringIO


from django.contrib.auth import models as auth_models

from django.conf import settings
from image_filer.utils.pil_exif import get_exif_for_file, set_exif_subject_location
from image_filer import context_processors

IMAGE_FILER_UPLOAD_ROOT = getattr(settings,'IMAGE_FILER_UPLOAD_ROOT', 'catalogue')

from image_filer.models.safe_file_storage import SafeFilenameFileSystemStorage
fs = SafeFilenameFileSystemStorage()

class AbstractFile(models.Model):
    """
    Represents a "File-ish" thing that is in a Folder. Any subclasses must
    at least define a foreign key to folder and a file field (or subclass thereof):
        path: return the full absolute path to the physical file (may be omited in special cases)
        file: return a file object
    """
    file_type = 'unknown'
    folder = models.ForeignKey("Folder", related_name='%(class)s_files', null=True, blank=True)
    
    original_filename = models.CharField(max_length=255, blank=True, null=True)
    name = models.CharField(max_length=255, null=True, blank=True)
    
    owner = models.ForeignKey(auth_models.User, related_name='owned_%(class)ss', null=True, blank=True)
    
    uploaded_at = models.DateTimeField(auto_now_add=True)
    modified_at = models.DateTimeField(auto_now=True)
    
    def __unicode__(self):
        if self.name in ('', None):
            text = u"%s" % (self.original_filename,)
        else:
            text = u"%s" % (self.name,)
        return text
    
    class Meta:
        abstract=True
<commit_msg>added check to make sure that image_filer.context_processors.media is in settings.TEMPLATE_CONTEXT_PROCESSORS<commit_after>import os
import mptt
from django.db import models
from django.db.models import Q
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.core.files.storage import FileSystemStorage
from django.core.files.base import File, ContentFile
from django.utils.translation import ugettext_lazy as _
from datetime import datetime, date
from image_filer.utils import EXIF
from sorl.thumbnail import fields as thumbnail_fields
from image_filer.fields import ImageFilerModelImageField, \
    ImageFilerModelFolderField

from managers import FolderManager
from django.db.models.signals import post_init
from django.utils.functional import curry
from django.core.urlresolvers import reverse
import StringIO


from django.contrib.auth import models as auth_models

from django.conf import settings
from image_filer.utils.pil_exif import get_exif_for_file, set_exif_subject_location
from image_filer import context_processors

IMAGE_FILER_UPLOAD_ROOT = getattr(settings,'IMAGE_FILER_UPLOAD_ROOT', 'catalogue')

from image_filer.models.safe_file_storage import SafeFilenameFileSystemStorage
fs = SafeFilenameFileSystemStorage()

from django.core.exceptions import ImproperlyConfigured
if not 'image_filer.context_processors.media' in settings.TEMPLATE_CONTEXT_PROCESSORS: raise ImproperlyConfigured("image_filer needs 'image_filer.context_processors.media' to be in settings.TEMPLATE_CONTEXT_PROCESSORS")


class AbstractFile(models.Model):
    """
    Represents a "File-ish" thing that is in a Folder. Any subclasses must
    at least define a foreign key to folder and a file field (or subclass thereof):
        path: return the full absolute path to the physical file (may be omited in special cases)
        file: return a file object
    """
    file_type = 'unknown'
    folder = models.ForeignKey("Folder", related_name='%(class)s_files', null=True, blank=True)
    
    original_filename = models.CharField(max_length=255, blank=True, null=True)
    name = models.CharField(max_length=255, null=True, blank=True)
    
    owner = models.ForeignKey(auth_models.User, related_name='owned_%(class)ss', null=True, blank=True)
    
    uploaded_at = models.DateTimeField(auto_now_add=True)
    modified_at = models.DateTimeField(auto_now=True)
    
    def __unicode__(self):
        if self.name in ('', None):
            text = u"%s" % (self.original_filename,)
        else:
            text = u"%s" % (self.name,)
        return text
    
    class Meta:
        abstract=True

{'fraction_non_alphanumeric': 0.07249898744430944, 'fraction_numerical': 0.002430133657351154, 'mean_word_length': 4.651029748283753, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1184684', 'n_tokens_mistral': 1429, 'n_tokens_neox': 1428, 'n_words': 410}