Hopefully fix this mutability bug completely

This commit is contained in:
Markus Unterwaditzer 2015-02-22 15:13:23 +01:00
parent 1e9fe12904
commit 2717c14e0c
2 changed files with 6 additions and 5 deletions

View file

@ -186,7 +186,6 @@ def _discover_from_config(config):
def _handle_collection_not_found(config, collection, e=None): def _handle_collection_not_found(config, collection, e=None):
storage_name = config.get('instance_name', None) storage_name = config.get('instance_name', None)
assert config.setdefault('collection', collection) == collection
cli_logger.error('{}No collection {} found for storage {}.' cli_logger.error('{}No collection {} found for storage {}.'
.format('{}\n'.format(e) if e else '', .format('{}\n'.format(e) if e else '',
@ -196,7 +195,7 @@ def _handle_collection_not_found(config, collection, e=None):
storage_type = config['type'] storage_type = config['type']
cls, config = storage_class_from_config(config) cls, config = storage_class_from_config(config)
try: try:
args = cls.create_collection(**config) args = cls.create_collection(collection=collection, **config)
args['type'] = storage_type args['type'] = storage_type
return args return args
except NotImplementedError as e: except NotImplementedError as e:

View file

@ -69,10 +69,12 @@ class FilesystemStorage(Storage):
@classmethod @classmethod
def create_collection(cls, collection, **kwargs): def create_collection(cls, collection, **kwargs):
rv = dict(kwargs)
if collection is not None: if collection is not None:
kwargs['path'] = os.path.join(kwargs['path'], collection) rv['path'] = os.path.join(rv['path'], collection)
checkdir(kwargs['path'], create=True) checkdir(rv['path'], create=True)
kwargs['collection'] = collection rv['collection'] = collection
return kwargs return kwargs
def _get_filepath(self, href): def _get_filepath(self, href):