summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcos <cos>2022-05-08 15:50:09 +0200
committercos <cos>2022-05-08 18:48:39 +0200
commitc20ed6a65acae6c4e1cdd0fa2b9dc73244932681 (patch)
treee0bb8e030ea34100bd8b3fc61e51eb663c93fc6c
parent2aae381f2cb499f203a994d217ce989a8d97071e (diff)
downloadpython-caldav-c20ed6a65acae6c4e1cdd0fa2b9dc73244932681.zip
Raise error when detecting failure to expand
-rw-r--r--caldav/objects.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/caldav/objects.py b/caldav/objects.py
index 42bda30..38346b3 100644
--- a/caldav/objects.py
+++ b/caldav/objects.py
@@ -734,7 +734,24 @@ class Calendar(DAVObject):
## avoid sending expand=True to xandikos, but perhaps we
## should run a try-except-retry here with expand=False in the
## retry, and warnings logged ... or perhaps not.
- return self.search(root, comp_class)
+ ##
+ ## Perhaps not? Detect and raise an Exception. Since the library
+ ## does not perform client side expansion, it should probably be
+ ## left as a concious desicion for the API consumer to retry with
+ ## expansion set to False.
+ ##
+ ## RFC4791, section 9.6.5 states that recurrence properties MUST NOT be
+ ## returned.
+ objects = self.search(root, comp_class)
+ if expand:
+ for o in objects:
+ components = o.instance.components()
+ for i in components:
+ if i.name == 'VEVENT':
+ recurrance_properties = ['exdate', 'exrule', 'rdate', 'rrule']
+ if any(key in recurrance_properties for key in i.contents):
+ raise error.ReportError('CalDAV server did not expand vevents as requested.')
+ return objects
def _request_report_build_resultlist(self, xml, comp_class=None, props=None, no_calendardata=False):
"""