Skip to content

meringue.core.utils.storage ¤

Storage helpers.

S3_STORAGE_MODULES module-attribute ¤

S3_STORAGE_MODULES: Final[frozenset[str]] = frozenset(
    {"storages.backends.s3", "storages.backends.s3boto3"}
)

Modules of the django-storages S3 backends. The storage is checked by its class hierarchy, so django-storages is never imported by meringue itself.

is_s3_storage_class ¤

is_s3_storage_class(storage_cls: type) -> bool

Checks that the storage class is a django-storages S3 storage (or its subclass).

Source code in meringue/core/utils/storage.py
def is_s3_storage_class(storage_cls: type) -> bool:
    """
    Checks that the storage class is a django-storages S3 storage (or its subclass).
    """

    return any(cls.__module__ in S3_STORAGE_MODULES for cls in storage_cls.__mro__)