Exemplo n.º 1
0
 def handle_app(self, app, **options):
     """
     Copy all static media files from an application.
     
     """
     ignore_patterns = options['ignore_patterns']
     prefix = utils.get_app_prefix(app)
     for storage in utils.app_static_storages(app):
         for path in utils.get_files(storage, ignore_patterns):
             self.copy_file(path, prefix, storage, **options)
Exemplo n.º 2
0
 def handle_app(self, app, **options):
     """
     Copy all static media files from an application.
     
     """
     ignore_patterns = options['ignore_patterns']
     prefix = utils.get_app_prefix(app)
     for storage in utils.app_static_storages(app):
         for path in utils.get_files(storage, ignore_patterns):
             self.copy_file(path, prefix, storage, **options)
Exemplo n.º 3
0
    def resolve_for_app(self, app, path, all=False):
        """
        Find a requested static file in an app's media locations.

        If ``all`` is ``False`` (default), return the first matching resolved
        absolute path (or ``None`` if no match). Otherwise return a list of
        resolved absolute paths.

        """
        prefix = utils.get_app_prefix(app)
        if prefix:
            prefix = '%s/' % prefix
            if not path.startswith(prefix):
                return []
            path = path[len(prefix):]
        paths = []
        for storage in utils.app_static_storages(app):
            if storage.exists(path):
                matched_path = storage.path(path)
                if not all:
                    return matched_path
                paths.append(matched_path)
        return paths
Exemplo n.º 4
0
def resolve_for_app(app, path, all=False):
    """
    Find a requested static file in an app's media locations.
    
    If ``all`` is ``False`` (default), return the first matching resolved
    absolute path (or ``None`` if no match). Otherwise return a list of
    resolved absolute paths.
    
    """
    prefix = utils.get_app_prefix(app)
    if prefix:
        prefix = '%s/' % prefix
        if not path.startswith(prefix):
            return []
        path = path[len(prefix):]
    paths = []
    for storage in utils.app_static_storages(app):
        if storage.exists(path):
            matched_path = storage.path(path)
            if not all:
                return matched_path
            paths.append(matched_path)
    return paths