From 6f4ff7aab108a86162a9f9aa734f54e4b8fd5cdc Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Tue, 27 Sep 2016 10:45:55 +0200 Subject: [PATCH] Replace Dav with DAV Fix #501 --- docs/config.rst | 4 ++-- tests/storage/dav/__init__.py | 2 +- tests/storage/dav/test_caldav.py | 8 ++++---- tests/storage/dav/test_carddav.py | 8 ++++---- vdirsyncer/cli/utils.py | 4 ++-- vdirsyncer/storage/dav.py | 26 +++++++++++++------------- vdirsyncer/storage/google.py | 6 +++--- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/config.rst b/docs/config.rst index bf30f36..e7ecea5 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -138,9 +138,9 @@ Supported Storages CalDAV and CardDAV ++++++++++++++++++ -.. autostorage:: vdirsyncer.storage.dav.CaldavStorage +.. autostorage:: vdirsyncer.storage.dav.CalDAVStorage -.. autostorage:: vdirsyncer.storage.dav.CarddavStorage +.. autostorage:: vdirsyncer.storage.dav.CardDAVStorage Google ++++++ diff --git a/tests/storage/dav/__init__.py b/tests/storage/dav/__init__.py index c5dded8..ae0b812 100644 --- a/tests/storage/dav/__init__.py +++ b/tests/storage/dav/__init__.py @@ -19,7 +19,7 @@ dav_server = os.environ['DAV_SERVER'] ServerMixin = get_server_mixin(dav_server) -class DavStorageTests(ServerMixin, StorageTests): +class DAVStorageTests(ServerMixin, StorageTests): dav_server = dav_server def test_dav_broken_item(self, s): diff --git a/tests/storage/dav/test_caldav.py b/tests/storage/dav/test_caldav.py index 636c9da..167fbb4 100644 --- a/tests/storage/dav/test_caldav.py +++ b/tests/storage/dav/test_caldav.py @@ -11,14 +11,14 @@ import requests.exceptions from tests import EVENT_TEMPLATE, TASK_TEMPLATE, VCARD_TEMPLATE from vdirsyncer import exceptions -from vdirsyncer.storage.dav import CaldavStorage +from vdirsyncer.storage.dav import CalDAVStorage -from . import DavStorageTests, dav_server +from . import DAVStorageTests, dav_server from .. import format_item -class TestCaldavStorage(DavStorageTests): - storage_class = CaldavStorage +class TestCalDAVStorage(DAVStorageTests): + storage_class = CalDAVStorage @pytest.fixture(params=['VTODO', 'VEVENT']) def item_type(self, request): diff --git a/tests/storage/dav/test_carddav.py b/tests/storage/dav/test_carddav.py index d0f8042..7aedaac 100644 --- a/tests/storage/dav/test_carddav.py +++ b/tests/storage/dav/test_carddav.py @@ -2,13 +2,13 @@ import pytest -from vdirsyncer.storage.dav import CarddavStorage +from vdirsyncer.storage.dav import CardDAVStorage -from . import DavStorageTests +from . import DAVStorageTests -class TestCarddavStorage(DavStorageTests): - storage_class = CarddavStorage +class TestCardDAVStorage(DAVStorageTests): + storage_class = CardDAVStorage @pytest.fixture(params=['VCARD']) def item_type(self, request): diff --git a/vdirsyncer/cli/utils.py b/vdirsyncer/cli/utils.py index 11691b2..823af16 100644 --- a/vdirsyncer/cli/utils.py +++ b/vdirsyncer/cli/utils.py @@ -37,8 +37,8 @@ DISCOVERY_CACHE_VERSION = 1 class _StorageIndex(object): def __init__(self): self._storages = dict( - caldav='vdirsyncer.storage.dav.CaldavStorage', - carddav='vdirsyncer.storage.dav.CarddavStorage', + caldav='vdirsyncer.storage.dav.CalDAVStorage', + carddav='vdirsyncer.storage.dav.CardDAVStorage', filesystem='vdirsyncer.storage.filesystem.FilesystemStorage', http='vdirsyncer.storage.http.HttpStorage', singlefile='vdirsyncer.storage.singlefile.SingleFileStorage', diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py index a8cf32b..7479a81 100644 --- a/vdirsyncer/storage/dav.py +++ b/vdirsyncer/storage/dav.py @@ -298,7 +298,7 @@ class CardDiscover(Discover): _well_known_uri = '/.well-known/carddav' -class DavSession(object): +class DAVSession(object): ''' A helper class to connect to DAV servers. ''' @@ -345,7 +345,7 @@ class DavSession(object): } -class DavStorage(Storage): +class DAVStorage(Storage): __doc__ = ''' :param url: Base URL or an URL to a collection. @@ -367,8 +367,8 @@ class DavStorage(Storage): get_multi_data_query = None # The Discover subclass to use discovery_class = None - # The DavSession class to use - session_class = DavSession + # The DAVSession class to use + session_class = DAVSession _repr_attributes = ('username', 'url') @@ -383,7 +383,7 @@ class DavStorage(Storage): self.session, kwargs = \ self.session_class.init_and_remaining_args(**kwargs) - super(DavStorage, self).__init__(**kwargs) + super(DAVStorage, self).__init__(**kwargs) import inspect __init__.__signature__ = inspect.signature(session_class.__init__) @@ -659,7 +659,7 @@ class DavStorage(Storage): # a PROPFIND to see if the value got actually set. -class CaldavStorage(DavStorage): +class CalDAVStorage(DAVStorage): __doc__ = ''' CalDAV. @@ -688,7 +688,7 @@ class CaldavStorage(DavStorage): :param item_types: Kind of items to show. The default, the empty list, is to show all. This depends on particular features on the server, the results are not validated. - ''' + DavStorage.__doc__ + ''' + DAVStorage.__doc__ storage_name = 'caldav' fileext = '.ics' @@ -710,14 +710,14 @@ class CaldavStorage(DavStorage): get_multi_data_query = '{urn:ietf:params:xml:ns:caldav}calendar-data' - _property_table = dict(DavStorage._property_table) + _property_table = dict(DAVStorage._property_table) _property_table.update({ 'color': ('calendar-color', 'http://apple.com/ns/ical/'), }) def __init__(self, start_date=None, end_date=None, item_types=(), **kwargs): - super(CaldavStorage, self).__init__(**kwargs) + super(CalDAVStorage, self).__init__(**kwargs) if not isinstance(item_types, (list, tuple)): raise exceptions.UserError('item_types must be a list.') @@ -761,7 +761,7 @@ class CaldavStorage(DavStorage): timefilter=timefilter) else: if start is not None and end is not None: - for x in CaldavStorage._get_list_filters(('VTODO', 'VEVENT'), + for x in CalDAVStorage._get_list_filters(('VTODO', 'VEVENT'), start, end): yield x @@ -779,7 +779,7 @@ class CaldavStorage(DavStorage): # instead? # # See https://github.com/dmfs/tasks/issues/118 for backstory. - for x in DavStorage.list(self): + for x in DAVStorage.list(self): yield x data = ''' @@ -811,11 +811,11 @@ class CaldavStorage(DavStorage): yield href, etag -class CarddavStorage(DavStorage): +class CardDAVStorage(DAVStorage): __doc__ = ''' CardDAV. - ''' + DavStorage.__doc__ + ''' + DAVStorage.__doc__ storage_name = 'carddav' fileext = '.vcf' diff --git a/vdirsyncer/storage/google.py b/vdirsyncer/storage/google.py index 2b53e16..d6520cc 100644 --- a/vdirsyncer/storage/google.py +++ b/vdirsyncer/storage/google.py @@ -27,7 +27,7 @@ except ImportError: have_oauth2 = False -class GoogleSession(dav.DavSession): +class GoogleSession(dav.DAVSession): def __init__(self, token_file, client_id, client_secret, url=None): # Required for discovering collections if url is not None: @@ -101,7 +101,7 @@ GOOGLE_PARAMS_DOCS = ''' ''' -class GoogleCalendarStorage(dav.CaldavStorage): +class GoogleCalendarStorage(dav.CalDAVStorage): __doc__ = '''Google calendar. Please refer to :storage:`caldav` regarding @@ -142,7 +142,7 @@ class GoogleCalendarStorage(dav.CaldavStorage): __init__._traverse_superclass = base.Storage -class GoogleContactsStorage(dav.CarddavStorage): +class GoogleContactsStorage(dav.CardDAVStorage): __doc__ = '''Google contacts. .. note:: Google's CardDAV implementation is allegedly a disaster in terms