Remove jsonfield dependency.
[audio.git] / src / archive / settings.py
index 476f6c7..747287d 100644 (file)
@@ -17,8 +17,9 @@ except AttributeError:
     FILES_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
                         "archive/files"))
 
-if FILES_PATH.startswith(settings.MEDIA_ROOT):
-    FILES_SAVE_PATH = FILES_PATH[len(settings.MEDIA_ROOT):].lstrip('/')
+_media_root = os.path.abspath(settings.MEDIA_ROOT)
+if FILES_PATH.startswith(_media_root):
+    FILES_SAVE_PATH = FILES_PATH[len(_media_root):].lstrip('/')
 
 
 # here the app keeps the unmanaged (archive) files
@@ -44,36 +45,11 @@ except AttributeError:
     BUILD_PATH = os.path.abspath(os.path.join(settings.MEDIA_ROOT,
                         "archive/build"))
 
-# upload conf
-try:
-    UPLOAD_HOST = settings.ARCHIVE_UPLOAD_HOST
-except AttributeError:
-    UPLOAD_HOST = 'wolnelektury.pl'
-
-try:
-    UPLOAD_USER = settings.ARCHIVE_UPLOAD_USER
-except AttributeError:
-    UPLOAD_USER = 'username'
-
-try:
-    UPLOAD_PASSWORD = settings.ARCHIVE_UPLOAD_PASSWORD
-except AttributeError:
-    UPLOAD_PASSWORD = None
-
-try:
-    UPLOAD_PATH = settings.ARCHIVE_UPLOAD_PATH
-except AttributeError:
-    UPLOAD_PATH = ''
-
-try:
-    UPLOAD_CMD = settings.ARCHIVE_UPLOAD_CMD
-except AttributeError:
-    UPLOAD_CMD = '/path/to/manage.py savemedia'
-
-try:
-    UPLOAD_SUDO = settings.ARCHIVE_UPLOAD_SUDO
-except AttributeError:
-    UPLOAD_SUDO = None
+UPLOAD_URL = getattr(
+    settings,
+    'ARCHIVE_UPLOAD_URL',
+    'audiobooks/'
+)
 
 
 try: