Skip to content

Commit

Permalink
Fixed object_by_uid() method. Checks if the event has the icalendar_c…
Browse files Browse the repository at this point in the history
…omponent attribute
  • Loading branch information
e-katkov authored and tobixen committed Oct 5, 2023
1 parent 1b56016 commit ce4004d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions caldav/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -1470,9 +1470,10 @@ def object_by_uid(self, uid, comp_filter=None, comp_class=None):
## but at one point it broke due to an extra CR in the data.
## Usage of the icalendar library increases readability and
## reliability
item_uid = item.icalendar_component.get("UID", None)
if item_uid and item_uid == uid:
items_found2.append(item)
if item.icalendar_component:
item_uid = item.icalendar_component.get("UID", None)
if item_uid and item_uid == uid:
items_found2.append(item)
if not items_found2:
raise error.NotFoundError("%s not found on server" % uid)
error.assert_(len(items_found2) == 1)
Expand Down

0 comments on commit ce4004d

Please sign in to comment.