Created
October 11, 2011 16:05
-
-
Save richleland/1278516 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_filename(self, basename): | |
| # first try to find it with staticfiles (in debug mode) | |
| filename = None | |
| if self.storage.exists(basename): | |
| try: | |
| filename = self.storage.path(basename) | |
| except NotImplementedError: | |
| local_storage = get_storage_class('compressor.storage.CompressorFileStorage')() | |
| filename = local_storage.path(basename) | |
| # secondly try finding the file in the root | |
| elif self.finders: | |
| filename = self.finders.find(basename) | |
| if filename: | |
| return filename | |
| # 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 ".")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment