mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
join_collection => create_collection
This commit is contained in:
parent
584e1d9d12
commit
cc0b8ad028
4 changed files with 9 additions and 10 deletions
|
|
@ -170,7 +170,7 @@ def _get_coll(pair_name, storage_name, collection, discovered, config):
|
||||||
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.join_collection(collection=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:
|
||||||
|
|
|
||||||
|
|
@ -109,10 +109,8 @@ class Storage(with_metaclass(StorageMeta)):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def join_collection(cls, collection, **kwargs):
|
def create_collection(cls, collection, **kwargs):
|
||||||
'''Append the collection to the URL or path specified in ``**kwargs``
|
'''Create the specified collection and return the new arguments.'''
|
||||||
and return the new arguments.
|
|
||||||
'''
|
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
|
|
||||||
|
|
@ -341,7 +341,7 @@ class DavStorage(Storage):
|
||||||
yield storage_args
|
yield storage_args
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def join_collection(cls, collection, **kwargs):
|
def create_collection(cls, collection, **kwargs):
|
||||||
session = cls._get_session(**kwargs)
|
session = cls._get_session(**kwargs)
|
||||||
d = cls.discovery_class(session)
|
d = cls.discovery_class(session)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,10 @@ class FilesystemStorage(Storage):
|
||||||
storage_name = 'filesystem'
|
storage_name = 'filesystem'
|
||||||
_repr_attributes = ('path',)
|
_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)
|
super(FilesystemStorage, self).__init__(**kwargs)
|
||||||
path = expand_path(path)
|
path = expand_path(path)
|
||||||
checkdir(path, create=create)
|
checkdir(path, create=False)
|
||||||
self.path = path
|
self.path = path
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
self.fileext = fileext
|
self.fileext = fileext
|
||||||
|
|
@ -66,8 +66,9 @@ class FilesystemStorage(Storage):
|
||||||
yield args
|
yield args
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def join_collection(cls, collection, **kwargs):
|
def create_collection(cls, collection, **kwargs):
|
||||||
kwargs['path'] = os.path.join(kwargs['path'], collection)
|
kwargs['path'] = path = os.path.join(kwargs['path'], collection)
|
||||||
|
checkdir(path, create=True)
|
||||||
return kwargs
|
return kwargs
|
||||||
|
|
||||||
def _get_filepath(self, href):
|
def _get_filepath(self, href):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue