示例#1
0
 def list(self, ignore_patterns):
     """
     List all files in all app storages.
     """
     for storage in self.storages.itervalues():
         if storage.exists(''):  # check if storage location exists
             for path in utils.get_files(storage, ignore_patterns):
                 yield path, storage
示例#2
0
 def list(self, ignore_patterns):
     """
     List all files in all app storages.
     """
     for storage in self.storages.values():
         if storage.exists(''): # check if storage location exists
             for path in utils.get_files(storage, ignore_patterns):
                 yield path, storage
示例#3
0
 def find_in_app(self, app, path):
     """
     Find a requested static file in an app's static locations.
     """
     storage = self.storages.get(app, None)
     if storage:
         if storage.prefix:
             prefix = '%s%s' % (storage.prefix, os.sep)
             if not path.startswith(prefix):
                 return None
             path = path[len(prefix):]
         # only try to find a file if the source dir actually exists
         if storage.exists(path):
             matched_path = storage.path(path)
             if matched_path:
                 return matched_path
示例#4
0
 def find_in_app(self, app, path):
     """
     Find a requested static file in an app's static locations.
     """
     storage = self.storages.get(app, None)
     if storage:
         if storage.prefix:
             prefix = '%s%s' % (storage.prefix, os.sep)
             if not path.startswith(prefix):
                 return None
             path = path[len(prefix):]
         # only try to find a file if the source dir actually exists
         if storage.exists(path):
             matched_path = storage.path(path)
             if matched_path:
                 return matched_path