Deal with Radicale 0.7

Fix #138
This commit is contained in:
Markus Unterwaditzer 2014-11-26 14:04:02 +01:00
parent 37c2467f59
commit 069f5dfa89
3 changed files with 20 additions and 9 deletions

View file

@ -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
<https://github.com/Kozea/Radicale/issues/146>`_, so setting ``start_date``

View file

@ -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')

View file

@ -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}.'