From 270915eb84ce8ba79f436e084f3c74066f0a79fb Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 21 Jun 2018 11:23:30 +0000 Subject: 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. --- pykolab/xml/event.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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]; -- cgit v1.1