diff options
author | Aleksander Machniak <machniak@kolabsys.com> | 2018-06-21 11:23:30 +0000 |
---|---|---|
committer | Aleksander Machniak <machniak@kolabsys.com> | 2018-06-21 11:23:30 +0000 |
commit | 270915eb84ce8ba79f436e084f3c74066f0a79fb (patch) | |
tree | 35dbddcee319bdc88651dbebf99de731a6ca7950 | |
parent | dcf133905f7aacc0c6fe61022af8103f895d648d (diff) | |
download | pykolab-270915eb84ce8ba79f436e084f3c74066f0a79fb.tar.gz |
Fix event|todo_from_ical() exception: AttributeError("'NoneType' object has no attribute 'tzinfo'",) (Bifrost#T75978)
We make sure we read DTSTART property before RECURRENCE-ID.
-rw-r--r-- | pykolab/xml/event.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/pykolab/xml/event.py b/pykolab/xml/event.py index 7ecdf36..9d1f9e6 100644 --- a/pykolab/xml/event.py +++ b/pykolab/xml/event.py @@ -19,6 +19,7 @@ from os import path from attendee import Attendee from contact_reference import ContactReference from recurrence_rule import RecurrenceRule +from collections import OrderedDict log = pykolab.getLogger('pykolab.xml_event') @@ -367,7 +368,8 @@ class Event(object): self.set_from_ical(attr.lower(), ical_event[attr]) # NOTE: Make sure to list(set()) or duplicates may arise - for attr in list(set(ical_event.singletons)): + # NOTE: Keep the original order e.g. to read DTSTART before RECURRENCE-ID + for attr in list(OrderedDict.fromkeys(ical_event.singletons)): if ical_event.has_key(attr): if isinstance(ical_event[attr], list): ical_event[attr] = ical_event[attr][0]; |