예제 #1
0
 def __init__(self, path=None, config=None):
     self._config = config
     # self._storage_layers = Storage(config)
     kind = config.get('storage_alternate', 'file')
     global alt
     print(kind)
     alt = driver.fetch(kind)
 def __init__(self, path=None, config=None):
     self._config = config
     # self._storage_layers = Storage(config)
     kind = config.get('storage_alternate', 'file')
     global alt
     print(kind)
     alt = driver.fetch(kind)
예제 #3
0
파일: __init__.py 프로젝트: shahabzd/docker
def load(kind=None):
    """Returns the right storage class according to the configuration."""
    global _storage
    cfg = config.load()
    if not kind:
        kind = cfg.storage.lower()
    if kind == 'local':
        kind = 'file'
    if kind in _storage:
        return _storage[kind]

    _storage[kind] = engine.fetch(kind)(path=cfg.storage_path, config=cfg)

    return _storage[kind]
 def __init__(self, path=None, config=None):
     self._config = config
     # self._storage_layers = Storage(config)
     #kind = config.get('storage_alternate', 'file')
     kind = 'file'
     try:
         kind = config['storage_alternate']
     except KeyError:
         pass
     
     global alt_driver
     global alt_instance
     alt_driver = driver.fetch(kind)
     alt_instance = alt_driver()
예제 #5
0
def load(kind=None):
    """Returns the right storage class according to the configuration."""
    global _storage
    cfg = config.load()
    if not kind:
        kind = cfg.storage.lower()
    if kind == 'local':
        kind = 'file'
    if kind in _storage:
        return _storage[kind]

    _storage[kind] = engine.fetch(kind)(None, config=cfg)

    return _storage[kind]
예제 #6
0
def load(kind=None):
    """Returns the right storage class according to the configuration."""
    global _storage
    cfg = config.load()
    logger.debug('storage kind: {0}'.format(cfg.storage.lower()))
    logger.debug('storage path: {0}'.format(cfg.storage_path))
    if not kind:
        kind = cfg.storage.lower()
    if kind == 'local':
        kind = 'file'
    if kind in _storage:
        return _storage[kind]

    _storage[kind] = engine.fetch(kind)(
        path=cfg.storage_path,
        config=cfg)

    return _storage[kind]
 def setUp(self):
     storage = driver.fetch(self.scheme)
     self._storage = storage(self.path, self.config)
예제 #8
0
 def testFetchingNonExistentDriver(self):
     driver.fetch("nonexistentstupidlynameddriver")
예제 #9
0
 def testFetchingDriver(self):
     dumb = driver.fetch(self.scheme)
     assert self.cls.Storage == dumb
     assert driver.Base in dumb.__bases__
예제 #10
0
 def setUp(self):
     storage = driver.fetch(self.scheme)
     self._storage = storage(self.path, self.config)