예제 #1
0
파일: base.py 프로젝트: wagnerwar/Moneta
 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
예제 #2
0
 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
예제 #3
0
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
예제 #4
0
파일: models.py 프로젝트: d9pouces/Moneta
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
예제 #5
0
def storage(name) -> BaseStorage:
    kwargs = settings.STORAGES.get(name, settings.STORAGES['default'])
    cls = import_path(kwargs['ENGINE'])
    return cls(**kwargs)
예제 #6
0
파일: models.py 프로젝트: d9pouces/Moneta
def storage(name) -> BaseStorage:
    kwargs = settings.STORAGES.get(name, settings.STORAGES['default'])
    cls = import_path(kwargs['ENGINE'])
    return cls(**kwargs)