From 43c2981a750b4f118a1b33423d3c520a43e2d6b2 Mon Sep 17 00:00:00 2001 From: Les Orchard Date: Sun, 9 Oct 2011 17:18:45 -0400 Subject: [PATCH] Tweaks to how upload paths are built --- badger/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/badger/models.py b/badger/models.py index a898ae1..ac95a0a 100644 --- a/badger/models.py +++ b/badger/models.py @@ -3,6 +3,7 @@ import logging from datetime import datetime, timedelta, tzinfo from time import time, gmtime, strftime +import os.path from os.path import dirname from urlparse import urljoin @@ -57,9 +58,9 @@ DEFAULT_BADGE_IMAGE = getattr(settings, 'BADGER_DEFAULT_BADGE_IMAGE', # Set up a file system for badge uploads that can be kept separate from the # rest of /media if necessary. Lots of hackery to ensure sensible defaults. UPLOADS_ROOT = getattr(settings, 'BADGER_UPLOADS_ROOT', - '%suploads/' % getattr(settings, 'MEDIA_ROOT', 'media/')) + os.path.join(getattr(settings, 'MEDIA_ROOT', 'media/'), 'uploads')) UPLOADS_URL = getattr(settings, 'BADGER_UPLOADS_URL', - '%suploads/' % getattr(settings, 'MEDIA_URL', '/media/')) + urljoin(getattr(settings, 'MEDIA_URL', '/media/'), 'uploads/')) BADGE_UPLOADS_FS = FileSystemStorage(location=UPLOADS_ROOT, base_url=UPLOADS_URL)