Esempio n. 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)
Esempio n. 3
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)(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()
Esempio n. 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]
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)
Esempio n. 8
0
 def testFetchingNonExistentDriver(self):
     driver.fetch("nonexistentstupidlynameddriver")
Esempio n. 9
0
 def testFetchingDriver(self):
     dumb = driver.fetch(self.scheme)
     assert self.cls.Storage == dumb
     assert driver.Base in dumb.__bases__
Esempio n. 10
0
 def setUp(self):
     storage = driver.fetch(self.scheme)
     self._storage = storage(self.path, self.config)