示例#1
0
def enable_depot():
    # DEPOT setup
    from depot.manager import DepotManager

    DepotManager.configure('contact_images', config, 'depot.contact_images.')

    DepotManager.alias('contact_image', 'contact_images')
示例#2
0
def setup():
    setup_database()

    DepotManager._clear()
    DepotManager.configure('default', {'depot.storage_path': './lfs'})
    DepotManager.configure('another', {'depot.storage_path': './lfs'})
    DepotManager.alias('another_alias', 'another')
    DepotManager.make_middleware(None)
示例#3
0
def setup():
    setup_database()

    DepotManager._clear()
    DepotManager.configure('default', {'depot.storage_path': './lfs'})
    DepotManager.configure('another', {'depot.storage_path': './lfs'})
    DepotManager.alias('another_alias', 'another')
    DepotManager.make_middleware(None)
示例#4
0
def setup():
    setup_database()

    DepotManager._clear()
    DepotManager.configure("default", {"depot.storage_path": "./lfs"})
    DepotManager.configure("another", {"depot.storage_path": "./lfs"})
    DepotManager.alias("another_alias", "another")
    DepotManager.make_middleware(None)
    def test_aliases(self):
        DepotManager.configure('first', {'depot.storage_path': './lfs'})
        DepotManager.configure('second', {'depot.storage_path': './lfs2'})

        DepotManager.alias('used_storage', 'first')
        storage = DepotManager.get('used_storage')
        assert storage.storage_path == './lfs', storage

        DepotManager.alias('used_storage', 'second')
        storage = DepotManager.get('used_storage')
        assert storage.storage_path == './lfs2', storage
示例#6
0
文件: app_cfg.py 项目: axant/molepaw
def enable_depot():
    import logging
    log = logging.getLogger('molepaw.depot')

    # DEPOT setup
    from depot.manager import DepotManager

    storages = {
        'category_images': 'category_image',
    }

    for storage in storages:
        prefix = 'depot.%s.' % storage
        log.info('Configuring Storage %s*', prefix)
        DepotManager.configure(storage, tg.config, prefix)
        DepotManager.alias(storages[storage], storage)
示例#7
0
def enable_depot(app):
    import logging
    log = logging.getLogger('stroller2.depot')

    # DEPOT setup
    from depot.manager import DepotManager

    storages = {
        'product_images': 'product_image'
    }

    for storage in storages:
        prefix = 'depot.%s.' % storage
        log.info('Configuring Storage %s*', prefix)
        DepotManager.configure(storage, tg.config, prefix)
        DepotManager.alias(storages[storage], storage)
    return app
示例#8
0
 def init_app(self, app):
     storage_conf = app.config.get("DEPOT_MEDIA_STORAGES", {})
     if not storage_conf:
         raise LookupError("""
             Media storage config is required when using the media extension.
             Please add `DEPOT_MEDIA_STORAGES`  to the app config,
     """)
     if "media_storage" not in storage_conf:
         raise ValueError(
             "A storage named *media_storage* is required when configuring `DEPOT_STORAGES`."
         )
     for name, opts in storage_conf.items():
         if name not in DepotManager._depots:
             DepotManager.configure(name, opts)
     for storage in ("image_storage", "document_storage"):
         if storage not in DepotManager._depots:
             DepotManager.alias(storage, "media_storage")
     if app.config.get("SERVE_MEDIA_FILES"):
         self._add_serving_routes(app)
 def test_alias_on_existing_storage(self):
     DepotManager.configure('mystorage', {'depot.storage_path': './lfs2'})
     DepotManager.alias('mystorage', 'mystorage')
示例#10
0
 def test_aliases_not_existing(self):
     DepotManager.alias('used_storage', 'first')