From a8a86edf206eac4c13328300456ae6e5a3b6a0b6 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 18 Dec 2014 12:38:32 +0100 Subject: [PATCH] fix auto_code, fix collection zip package filename, update sandbox/settings --- example/sandbox/settings.py | 45 ++++++++++++++++++++++++++++++------ telemeta/views/collection.py | 2 +- telemeta/views/item.py | 2 +- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/example/sandbox/settings.py b/example/sandbox/settings.py index 33ea4882..d078bb51 100644 --- a/example/sandbox/settings.py +++ b/example/sandbox/settings.py @@ -4,11 +4,14 @@ import os, sys from django.core.urlresolvers import reverse_lazy, reverse +sys.dont_write_bytecode = True + +BASE_DIR = os.path.dirname(os.path.dirname(__file__)) + DEBUG = True TEMPLATE_DEBUG = DEBUG -# ALLOWED_HOSTS = ('localhost',) -sys.dont_write_bytecode = True +ALLOWED_HOSTS = ['*'] ADMINS = ( ('Guillaume Pellerin', 'yomguy@parisson.com'), @@ -58,10 +61,10 @@ USE_L10N = True # Absolute path to the directory that holds media. # Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media/') +MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') if not os.path.exists(MEDIA_ROOT): - os.mkdir(MEDIA_ROOT) + os.mkdir(MEDIA_ROOT) # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash if there is a path component (optional in other cases). @@ -164,10 +167,13 @@ SESSION_ENGINE = "django.contrib.sessions.backends.signed_cookies" TELEMETA_ORGANIZATION = 'Parisson' TELEMETA_SUBJECTS = ('test', 'telemeta', 'sandbox') TELEMETA_DESCRIPTION = "Telemeta TEST sandbox" +TELEMETA_LOGO = STATIC_URL + 'telemeta/images/logo_telemeta_2.png' + TELEMETA_GMAP_KEY = 'ABQIAAAArg7eSfnfTkBRma8glnGrlxRVbMrhnNNvToCbZQtWdaMbZTA_3RRGObu5PDoiBImgalVnnLU2yN4RMA' -TELEMETA_CACHE_DIR = MEDIA_ROOT + 'cache/' -TELEMETA_EXPORT_CACHE_DIR = MEDIA_ROOT + 'export/' -TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "data/" + +TELEMETA_CACHE_DIR = os.path.join(MEDIA_ROOT, 'cache') +TELEMETA_EXPORT_CACHE_DIR = os.path.join(MEDIA_ROOT, 'export') +TELEMETA_DATA_CACHE_DIR = os.path.join(TELEMETA_CACHE_DIR, 'data') TELEMETA_DOWNLOAD_ENABLED = True TELEMETA_STREAMING_FORMATS = ('mp3', 'ogg') @@ -220,3 +226,28 @@ DEBUG_TOOLBAR_PANELS = [ SUIT_CONFIG = { 'ADMIN_NAME': 'Telemeta Admin' } + + +# LOG_DIR = os.path.join(BASE_DIR, 'log') + +# if not os.path.exists(LOG_DIR): +# os.mkdir(LOG_DIR) + +# LOGGING = { +# 'version': 1, +# 'disable_existing_loggers': False, +# 'handlers': { +# 'file': { +# 'level': 'DEBUG', +# 'class': 'logging.FileHandler', +# 'filename': os.path.join(LOG_DIR, 'debug.log') +# }, +# }, +# 'loggers': { +# 'django.request': { +# 'handlers': ['file'], +# 'level': 'DEBUG', +# 'propagate': True, +# }, +# }, +# } diff --git a/telemeta/views/collection.py b/telemeta/views/collection.py index 06bd2c74..db5916eb 100644 --- a/telemeta/views/collection.py +++ b/telemeta/views/collection.py @@ -221,7 +221,7 @@ class CollectionPackageView(View): response = HttpResponse(z, content_type='application/zip') response['Content-Disposition'] = "attachment; filename=%s.%s" % \ - (item.code, 'zip') + (collection.code, 'zip') return response @method_decorator(login_required) diff --git a/telemeta/views/item.py b/telemeta/views/item.py index 82816baa..2adebde9 100644 --- a/telemeta/views/item.py +++ b/telemeta/views/item.py @@ -769,7 +769,7 @@ class ItemAddView(ItemViewMixin, CreateWithInlinesView): collection = collections[0] item.collection = collection items = MediaItem.objects.filter(collection=collection) - item.code = auto_code(items, collection.code) + item.code = auto_code(collection) return model_to_dict(item) def get_success_url(self): -- 2.39.5