diff --git a/makemessages.py b/makemessages.py index d0e4966..2feea0a 100755 --- a/makemessages.py +++ b/makemessages.py @@ -6,13 +6,14 @@ from django.conf import settings from django.core.management import call_command + def main(): if not settings.configured: module_root = path.dirname(path.realpath(__file__)) settings.configure( - DEBUG = False, - INSTALLED_APPS = ( + DEBUG=False, + INSTALLED_APPS=( 'private_storage', ), ) @@ -20,9 +21,11 @@ def main(): django.setup() makemessages() + def makemessages(): os.chdir('private_storage') call_command('makemessages', locale=('en', 'nl'), verbosity=1) + if __name__ == '__main__': main() diff --git a/private_storage/fields.py b/private_storage/fields.py index 2053844..b079ee2 100644 --- a/private_storage/fields.py +++ b/private_storage/fields.py @@ -19,7 +19,6 @@ logger = logging.getLogger(__name__) - class PrivateFileField(models.FileField): """ Filefield with private storage, custom filename and size checks. diff --git a/private_storage/storage/files.py b/private_storage/storage/files.py index 64e78d1..a6d1b58 100644 --- a/private_storage/storage/files.py +++ b/private_storage/storage/files.py @@ -19,6 +19,7 @@ class PrivateFileSystemStorage(FileSystemStorage): Interface to the Django storage system, storing the files in a private folder. """ + def __init__(self, location=None, base_url=None, **kwargs): if location is None: location = appconfig.PRIVATE_STORAGE_ROOT diff --git a/runtests.py b/runtests.py index bae308d..a084002 100755 --- a/runtests.py +++ b/runtests.py @@ -10,18 +10,18 @@ sys.path.insert(0, path.join(module_root, 'example')) settings.configure( - DEBUG = False, # will be False anyway by DjangoTestRunner. - DATABASES = { + DEBUG=False, # will be False anyway by DjangoTestRunner. + DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:' } }, - INSTALLED_APPS = ( + INSTALLED_APPS=( 'private_storage', ), - TEST_RUNNER = 'django.test.runner.DiscoverRunner', - TEMPLATES = [ + TEST_RUNNER='django.test.runner.DiscoverRunner', + TEMPLATES=[ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': (), @@ -49,5 +49,6 @@ def runtests(): argv = sys.argv[:1] + ['test', 'private_storage'] + sys.argv[1:] execute_from_command_line(argv) + if __name__ == '__main__': runtests()