diff --git a/docs/supported.rst b/docs/supported.rst index 8112738..5bbe1f7 100644 --- a/docs/supported.rst +++ b/docs/supported.rst @@ -48,7 +48,8 @@ Radicale -------- Vdirsyncer is tested against the git version and the latest PyPI release of -Radicale. +Radicale. Versions ``<= 0.7`` have substantial deficiencies, and using them is +neither supported nor encouraged. - Radicale doesn't `support time ranges in the calendar-query of CalDAV `_, so setting ``start_date`` diff --git a/tests/storage/dav/servers/radicale/__init__.py b/tests/storage/dav/servers/radicale/__init__.py index 9be6748..9959701 100644 --- a/tests/storage/dav/servers/radicale/__init__.py +++ b/tests/storage/dav/servers/radicale/__init__.py @@ -59,14 +59,19 @@ def do_the_radicale_dance(tmpdir): import radicale.config # Now we can set some basic configuration. - radicale.config.set('rights', 'type', 'owner_only') - radicale.config.set('auth', 'type', 'http') + # Radicale <=0.7 doesn't work with this, therefore we just catch the + # exception and assume Radicale is open for everyone. + try: + radicale.config.set('rights', 'type', 'owner_only') + radicale.config.set('auth', 'type', 'http') - import radicale.auth.http + import radicale.auth.http - def is_authenticated(user, password): - return user == 'bob' and password == 'bob' - radicale.auth.http.is_authenticated = is_authenticated + def is_authenticated(user, password): + return user == 'bob' and password == 'bob' + radicale.auth.http.is_authenticated = is_authenticated + except Exception as e: + print(e) if storage_backend == 'filesystem': radicale.config.set('storage', 'type', 'filesystem') diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py index 7ce521e..dd84e28 100644 --- a/vdirsyncer/storage/dav.py +++ b/vdirsyncer/storage/dav.py @@ -419,9 +419,14 @@ class DavStorage(Storage): contenttype = prop.find('{DAV:}getcontenttype').text - etag = prop.find('{DAV:}getetag').text href = self._normalize_href(element.find('{DAV:}href').text) - if self.item_mimetype not in contenttype: + etag = prop.find('{DAV:}getetag').text + if not etag: + raise ValueError('Server did not return an etag for item {}. ' + 'Vdirsyncer is unable to function without ' + 'one.'.format(href)) + + if not contenttype or self.item_mimetype not in contenttype: dav_logger.debug( 'Skipping item with href {!r} ' 'because content type {!r} != {!r}.'