Skip to content

Commit 0140d80

Browse files
committed
style
1 parent ae4ec8d commit 0140d80

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

caldav/davclient.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,12 @@ def __init__(
115115
no_xml = ["text/plain", "text/calendar", "application/octet-stream"]
116116
expect_xml = any((content_type.startswith(x) for x in xml))
117117
expect_no_xml = any((content_type.startswith(x) for x in no_xml))
118-
if content_type and not expect_xml and not expect_no_xml and response.status_code<400:
118+
if (
119+
content_type
120+
and not expect_xml
121+
and not expect_no_xml
122+
and response.status_code < 400
123+
):
119124
error.weirdness(f"Unexpected content type: {content_type}")
120125
try:
121126
content_length = int(self.headers["Content-Length"])
@@ -352,10 +357,14 @@ def _expand_simple_prop(
352357
if proptag in props_found:
353358
prop_xml = props_found[proptag]
354359
for item in prop_xml.items():
355-
if item[0].lower().endswith('content-type') and item[1].lower() == 'text/calendar':
356-
continue
357-
if item[0].lower().endswith('version') and item[1] in ("2", "2.0"):
358-
continue
360+
if proptag == "{urn:ietf:params:xml:ns:caldav}calendar-data":
361+
if (
362+
item[0].lower().endswith("content-type")
363+
and item[1].lower() == "text/calendar"
364+
):
365+
continue
366+
if item[0].lower().endswith("version") and item[1] in ("2", "2.0"):
367+
continue
359368
log.error(
360369
f"If you see this, please add a report at https://github.com/python-caldav/caldav/issues/209 - in _expand_simple_prop, dealing with {proptag}, extra item found: {'='.join(item)}."
361370
)

0 commit comments

Comments
 (0)