Skip to content

Commit

Permalink
Always use staticfiles finders to get the filename when in debug mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaap3 authored and jezdez committed Apr 14, 2011
1 parent 1b43826 commit e993e71
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions compressor/base.py
Expand Up @@ -53,18 +53,19 @@ def get_filename(self, url):
basename = basename.split("?", 1)[0]
# first try finding the file in the root
filename = os.path.join(settings.COMPRESS_ROOT, basename)
if not os.path.exists(filename):
# if not found and staticfiles is installed, use it
if (settings.DEBUG and self.finders) or not os.path.exists(filename):
filename = None
if self.finders:
# if not found and staticfiles is installed, use it
filename = self.finders.find(basename)
if filename:
return filename
if filename:
return filename
else:
# or just raise an exception as the last resort
raise UncompressableFileError(
"'%s' could not be found in the COMPRESS_ROOT '%s'%s" % (
basename, settings.COMPRESS_ROOT,
self.finders and " or with staticfiles." or "."))
return filename

@cached_property
def parser(self):
Expand Down

0 comments on commit e993e71

Please sign in to comment.