summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Brox <tobias@redpill-linpro.com>2022-05-08 22:02:48 +0200
committerTobias Brox <tobias@redpill-linpro.com>2022-05-08 22:02:48 +0200
commitddcd11508290b0dbc580dde0f2aa712d95d1e6f7 (patch)
treef5f6258bcfd47bdd5b486c63790ab5846f6147e2
parentc20ed6a65acae6c4e1cdd0fa2b9dc73244932681 (diff)
downloadpython-caldav-ddcd11508290b0dbc580dde0f2aa712d95d1e6f7.zip
we should probably not raise an error, but rather log an error on expansion failures - also added reference to the github issue. Updates https://github.com/python-caldav/caldav/issues/157
-rw-r--r--caldav/objects.py17
-rw-r--r--tests/compatibility_issues.py2
2 files changed, 13 insertions, 6 deletions
diff --git a/caldav/objects.py b/caldav/objects.py
index 38346b3..a7448aa 100644
--- a/caldav/objects.py
+++ b/caldav/objects.py
@@ -702,10 +702,9 @@ class Calendar(DAVObject):
root = cdav.CalendarQuery() + [prop, filter]
return root
- def date_search(self, start, end=None, compfilter="VEVENT", expand="maybe"):
+ def date_search(self, start, end=None, compfilter="VEVENT", expand="maybe", verify_expand=False):
# type (TimeStamp, TimeStamp, str, str) -> CalendarObjectResource
- """
- Search events by date in the calendar. Recurring events are
+ """Search events by date in the calendar. Recurring events are
expanded if they are occuring during the specified time frame
and if an end timestamp is given.
@@ -717,6 +716,11 @@ class Calendar(DAVObject):
* expand - should recurrent events be expanded? (to preserve
backward-compatibility the default "maybe" will be changed into True
unless the date_search is open-ended)
+ * verify_expand - quite some servers does not support
+ expansion. If verify_expand is set to True, an error will
+ be raised if expansion is requested but the server does not
+ support expansion. Defaults to False for
+ backward-compatibility.
Returns:
* [CalendarObjectResource(), ...]
@@ -745,12 +749,15 @@ class Calendar(DAVObject):
objects = self.search(root, comp_class)
if expand:
for o in objects:
- components = o.instance.components()
+ components = o.vobject_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.')
+ if verify_expansion:
+ raise error.ReportError('CalDAV server did not expand recurring vevents as requested. See https://github.com/python-caldav/caldav/issues/157')
+ else:
+ logging.error('CalDAV server does not support recurring events properly. See https://github.com/python-caldav/caldav/issues/157')
return objects
def _request_report_build_resultlist(self, xml, comp_class=None, props=None, no_calendardata=False):
diff --git a/tests/compatibility_issues.py b/tests/compatibility_issues.py
index 5da5605..84c4caf 100644
--- a/tests/compatibility_issues.py
+++ b/tests/compatibility_issues.py
@@ -267,7 +267,7 @@ sogo = [
]
nextcloud = [
- 'no_sync_token',
+ 'sync_breaks_on_delete',
'no_recurring_todo',
'no_recurring_todo_expand',
]