def get_models(cls): if cls._models is None: # noinspection PyPep8Naming cls._models = {} for mw_path in settings.REPOSITORY_CLASSES: modelcls = import_path(mw_path)() cls._models[modelcls.archive_type] = modelcls return cls._models
def archive_filters(): """ Check if archive filters set in settings are loaded. If not, load them. :return: a list of callable to call on new archives files. """ result = [] for middleware_path in settings.ARCHIVE_FILTERS: result.append(import_path(middleware_path)) return result
def storage(name) -> BaseStorage: kwargs = settings.STORAGES.get(name, settings.STORAGES['default']) cls = import_path(kwargs['ENGINE']) return cls(**kwargs)