diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index 368db19..7493f0a 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -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: diff --git a/vdirsyncer/storage/base.py b/vdirsyncer/storage/base.py index 0a3fd64..f974d01 100644 --- a/vdirsyncer/storage/base.py +++ b/vdirsyncer/storage/base.py @@ -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): diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py index 4c78087..870834e 100644 --- a/vdirsyncer/storage/dav.py +++ b/vdirsyncer/storage/dav.py @@ -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) diff --git a/vdirsyncer/storage/filesystem.py b/vdirsyncer/storage/filesystem.py index 6a17c59..d5735dc 100644 --- a/vdirsyncer/storage/filesystem.py +++ b/vdirsyncer/storage/filesystem.py @@ -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):