mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
parent
ac3fd8d7fc
commit
6f4ff7aab1
7 changed files with 29 additions and 29 deletions
|
|
@ -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
|
||||
++++++
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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 = '''<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue