Skip collections first

This avoids FUD errors later when trying to access e.g. etags for it.
This commit is contained in:
Markus Unterwaditzer 2015-01-04 00:21:54 +01:00
parent 863d574261
commit 742109f542

View file

@ -478,25 +478,23 @@ class DavStorage(Storage):
.format(href))
continue
try:
props = response.findall('{DAV:}propstat/{DAV:}prop')
if props is None:
raise InvalidXMLResponse()
props = _merge_xml(props)
etag = getattr(props.find('{DAV:}getetag'), 'text', '')
if not etag:
raise InvalidXMLResponse('Etag is missing.')
except InvalidXMLResponse as e:
dav_logger.error(str(e))
props = response.findall('{DAV:}propstat/{DAV:}prop')
if props is None:
dav_logger.warning('Skipping {!r}, properties are missing.'
.format(href))
continue
else:
props = _merge_xml(props)
if props.find('{DAV:}resourcetype/{DAV:}collection') is not None:
dav_logger.debug('Skipping {!r}, is collection.'.format(href))
continue
etag = getattr(props.find('{DAV:}getetag'), 'text', '')
if not etag:
dav_logger.warning('Skipping {!r}, etag property is missing.'
.format(href))
contenttype = getattr(props.find('{DAV:}getcontenttype'),
'text', None)
if not self._is_item_mimetype(contenttype):