Commits

Alan Justino committed 927ab15

Enabled .path(), but not for collectstatic command

Comments (0)

Files changed (1)

storages/backends/filecache.py

         :type name: str
         :rtype: str
         """
-        raise NotImplementedError()
-        #try:
-        #    return self._get_storage(name).path(name)
-        #except NotImplementedError, e:
-        #    if self.using_cache(name):
-        #        raise
-        #    else: # Maybe is worth to try with cache_storage if master failed
-        #        self._transfer(name, origin=self.master_storage, destiny=self.cache_storage)
-        #        return self.cache_storage.path(name)
+        if name == '': # Disables .path() just for collecstatic
+            raise NotImplementedError()
+
+        try:
+            return self._get_storage(name).path(name)
+        except NotImplementedError, e:
+            if self.using_cache(name):
+                raise
+            else: # Maybe is worth to try with cache_storage if master failed
+                self._transfer(name, origin=self.master_storage, destiny=self.cache_storage)
+                return self.cache_storage.path(name)
 
 
 class FileSystemCachedS3BotoStorage(FileCacheMixin, Storage):