mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-10 11:35:53 +00:00
Fix xandikos test: multistatus parsing
This commit is contained in:
parent
7f80251527
commit
6a273953f7
1 changed files with 19 additions and 0 deletions
|
|
@ -41,6 +41,23 @@ def _contains_quoted_reserved_chars(x):
|
|||
return False
|
||||
|
||||
|
||||
def _assert_multistatus_success(r):
|
||||
# Xandikos returns a multistatus on PUT.
|
||||
try:
|
||||
root = _parse_xml(r.content)
|
||||
except InvalidXMLResponse:
|
||||
print("INVALID RESPONSE")
|
||||
return
|
||||
for status in root.findall('.//{DAV:}status'):
|
||||
parts = status.text.strip().split()
|
||||
try:
|
||||
st = int(parts[1])
|
||||
except (ValueError, IndexError):
|
||||
continue
|
||||
if st < 200 or st >= 400:
|
||||
raise HTTPError('Server error: {}'.format(st))
|
||||
|
||||
|
||||
def _normalize_href(base, href):
|
||||
'''Normalize the href to be a path only relative to hostname and
|
||||
schema.'''
|
||||
|
|
@ -499,6 +516,8 @@ class DAVStorage(Storage):
|
|||
headers=headers
|
||||
)
|
||||
|
||||
_assert_multistatus_success(response)
|
||||
|
||||
# The server may not return an etag under certain conditions:
|
||||
#
|
||||
# An origin server MUST NOT send a validator header field (Section
|
||||
|
|
|
|||
Loading…
Reference in a new issue