Skip to content

Commit

Permalink
Skip broken props in get_multi
Browse files Browse the repository at this point in the history
  • Loading branch information
untitaker committed Dec 7, 2014
1 parent be14457 commit 6f8c670
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions vdirsyncer/storage/dav.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,18 @@ def get_multi(self, hrefs):
for element in root.iter('{DAV:}response'):
href = self._normalize_href(
element.find('{DAV:}href').text)
raw = element \
.find('{DAV:}propstat') \
.find('{DAV:}prop') \
.find(self.get_multi_data_query).text
etag = element \
.find('{DAV:}propstat') \
.find('{DAV:}prop') \
.find('{DAV:}getetag').text

try:
prop = element.find('{DAV:}propstat').find('{DAV:}prop')
raw = prop.find(self.get_multi_data_query).text
etag = prop.find('{DAV:}getetag').text
if not raw or not etag:
raise AttributeError()
except AttributeError:
dav_logger.warning('Skipping {}, properties are missing.'
.format(href))
continue

if isinstance(raw, bytes):
raw = raw.decode(response.encoding)
if isinstance(etag, bytes):
Expand Down

0 comments on commit 6f8c670

Please sign in to comment.