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 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()
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)
def testFetchingNonExistentDriver(self): driver.fetch("nonexistentstupidlynameddriver")
def testFetchingDriver(self): dumb = driver.fetch(self.scheme) assert self.cls.Storage == dumb assert driver.Base in dumb.__bases__