join_collection => create_collection

This commit is contained in:
Markus Unterwaditzer 2014-12-31 13:27:06 +01:00
parent 584e1d9d12
commit cc0b8ad028
4 changed files with 9 additions and 10 deletions

View file

@ -170,7 +170,7 @@ def _get_coll(pair_name, storage_name, collection, discovered, config):
storage_type = config['type']
cls, config = storage_class_from_config(config)
try:
args = cls.join_collection(collection=collection, **config)
args = cls.create_collection(collection=collection, **config)
args['type'] = storage_type
return args
except NotImplementedError as e:

View file

@ -109,10 +109,8 @@ class Storage(with_metaclass(StorageMeta)):
raise NotImplementedError()
@classmethod
def join_collection(cls, collection, **kwargs):
'''Append the collection to the URL or path specified in ``**kwargs``
and return the new arguments.
'''
def create_collection(cls, collection, **kwargs):
'''Create the specified collection and return the new arguments.'''
raise NotImplementedError()
def __repr__(self):

View file

@ -341,7 +341,7 @@ class DavStorage(Storage):
yield storage_args
@classmethod
def join_collection(cls, collection, **kwargs):
def create_collection(cls, collection, **kwargs):
session = cls._get_session(**kwargs)
d = cls.discovery_class(session)

View file

@ -39,10 +39,10 @@ class FilesystemStorage(Storage):
storage_name = 'filesystem'
_repr_attributes = ('path',)
def __init__(self, path, fileext, encoding='utf-8', create=True, **kwargs):
def __init__(self, path, fileext, encoding='utf-8', **kwargs):
super(FilesystemStorage, self).__init__(**kwargs)
path = expand_path(path)
checkdir(path, create=create)
checkdir(path, create=False)
self.path = path
self.encoding = encoding
self.fileext = fileext
@ -66,8 +66,9 @@ class FilesystemStorage(Storage):
yield args
@classmethod
def join_collection(cls, collection, **kwargs):
kwargs['path'] = os.path.join(kwargs['path'], collection)
def create_collection(cls, collection, **kwargs):
kwargs['path'] = path = os.path.join(kwargs['path'], collection)
checkdir(path, create=True)
return kwargs
def _get_filepath(self, href):