Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Python 3.7 is no longer tested - but it should work. Please file a bug report i
* By now `calendar.search(..., sort_keys=("DTSTART")` will work. Sort keys expects a list or a tuple, but it's easy to send an attribute by mistake. https://github.com/python-caldav/caldav/issues/448 https://github.com/python-caldav/caldav/pull/449
* Compatibility workaround: If `event.load()` fails, it will retry the load by doing a multiget - https://github.com/python-caldav/caldav/pull/475 - https://github.com/python-caldav/caldav/issues/459
* The `class_`-parameter now works when sending data to `save_event()` etc.
* Search method now takes parameter `journal=True`. ref https://github.com/python-caldav/caldav/issues/237 and https://github.com/python-caldav/caldav/pull/486

### Fixed

Expand Down
2 changes: 2 additions & 0 deletions caldav/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -868,8 +868,10 @@ def search(
raise

obj2 = []

for o in objects:
## This would not be needed if the servers would follow the standard ...
## TODO: use self.calendar_multiget - see https://github.com/python-caldav/caldav/issues/487
try:
o.load(only_if_unloaded=True)
obj2.append(o)
Expand Down
31 changes: 27 additions & 4 deletions tests/test_caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,31 @@ def testChangeAttendeeStatusWithEmailGiven(self):
event = c.event_by_uid("test1")
## TODO: work in progress ... see https://github.com/python-caldav/caldav/issues/399

def testMultiGet(self):
self.skip_on_compatibility_flag("read_only")
c = self._fixCalendar()

event1 = c.save_event(
uid="test1",
dtstart=datetime(2015, 10, 10, 8, 7, 6),
dtend=datetime(2015, 10, 10, 9, 7, 6),
summary="test1",
)

event2 = c.save_event(
uid="test2",
dtstart=datetime(2015, 10, 10, 8, 7, 6),
dtend=datetime(2015, 10, 10, 9, 7, 6),
summary="test2",
)

results = c.calendar_multiget([event1.url, event2.url])
assert len(results) == 2
assert set([x.icalendar_component["uid"] for x in results]) == {
"test1",
"test2",
}

def testCreateEvent(self):
self.skip_on_compatibility_flag("read_only")
c = self._fixCalendar()
Expand Down Expand Up @@ -1278,12 +1303,10 @@ def testLoadEvent(self):
c2 = self._fixCalendar(name="Yapp", cal_id=self.testcal_id2)

e1_ = c1.save_event(ev1)
if not self.check_compatibility_flag("event_by_url_is_broken"):
e1_.load()
e1_.load()
e1 = c1.events()[0]
assert e1.url == e1_.url
if not self.check_compatibility_flag("event_by_url_is_broken"):
e1.load()
e1.load()
if (
not self.check_compatibility_flag("unique_calendar_ids")
and self.cleanup_regime == "post"
Expand Down