Skip to main content

BaseStorageFinder

A base static files finder to be used to extended with an own storage class.

Attributes

AttributeTypeDescription
storageStorage or LazyObject = NoneThe storage instance or class used to locate and retrieve static files.

Constructor

Signature

def BaseStorageFinder(
storage: Storage|LazyObject|type|None = None,
*args: any,
**kwargs: any
) - > null

Parameters

NameTypeDescription
storage`StorageLazyObject
*argsanyVariable length argument list passed to the parent class.
**kwargsanyArbitrary keyword arguments passed to the parent class.

Signature

def BaseStorageFinder(
storage: Storage|LazyObject|type = None,
*args: tuple,
**kwargs: dict
)

Parameters

NameTypeDescription
storage`StorageLazyObject
*argstupleVariable length argument list passed to the parent BaseFinder class.
**kwargsdictArbitrary keyword arguments passed to the parent BaseFinder class.

Methods


find()

@classmethod
def find(
path: string,
find_all: boolean = False
) - > string|list

Look for files in the default file storage, if it's local.

Parameters

NameTypeDescription
pathstringThe relative path of the static file to locate within the storage backend.
find_allboolean = FalseDetermines whether to return a single match or a list containing the match.

Returns

TypeDescription
`stringlist`

list()

@classmethod
def list(
ignore_patterns: list
) - > generator

List all files of the storage.

Parameters

NameTypeDescription
ignore_patternslistA list of glob patterns used to exclude specific files or directories from the resulting list.

Returns

TypeDescription
generatorA generator yielding tuples of (path, storage_instance) for every file found in the storage backend.