BaseStorageFinder
A base static files finder to be used to extended with an own storage class.
Attributes
| Attribute | Type | Description |
|---|---|---|
| storage | Storage or LazyObject = None | The 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
| Name | Type | Description |
|---|---|---|
| storage | `Storage | LazyObject |
| *args | any | Variable length argument list passed to the parent class. |
| **kwargs | any | Arbitrary keyword arguments passed to the parent class. |
Signature
def BaseStorageFinder(
storage: Storage|LazyObject|type = None,
*args: tuple,
**kwargs: dict
)
Parameters
| Name | Type | Description |
|---|---|---|
| storage | `Storage | LazyObject |
| *args | tuple | Variable length argument list passed to the parent BaseFinder class. |
| **kwargs | dict | Arbitrary 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
| Name | Type | Description |
|---|---|---|
| path | string | The relative path of the static file to locate within the storage backend. |
| find_all | boolean = False | Determines whether to return a single match or a list containing the match. |
Returns
| Type | Description |
|---|---|
| `string | list` |
list()
@classmethod
def list(
ignore_patterns: list
) - > generator
List all files of the storage.
Parameters
| Name | Type | Description |
|---|---|---|
| ignore_patterns | list | A list of glob patterns used to exclude specific files or directories from the resulting list. |
Returns
| Type | Description |
|---|---|
generator | A generator yielding tuples of (path, storage_instance) for every file found in the storage backend. |