When vobject.readOne() or vobject.iCalendar() is used to read or create multiple calendars, the first time a timezone is encountered, its name is recorded in __tzidMap so that the timezone can later be discovered by name.
This is problematic because registerTzinfo() remembers the first instance, and not the most recent instance:
tzid = obj.pickTzid(tzinfo)
if tzid and not getTzid(tzid, False):
registerTzid(tzid, tzinfo)
return tzid
This means that in subsequent calendars contrary to its nameregisterTzinfo() does not register the instance, and a getTzid() actually retrieves the first instance that was encountered much earlier.
One scenario where this can be a problem is where calendar is ingested using readOne() containing some potentially arbitrary VTIMEZONE. After this a new calendar is created, and rather than using the definitive timezone information from pytz, instead uses the information read from the first calendar obtained via __tzidMap.
When
vobject.readOne()
orvobject.iCalendar()
is used to read or create multiple calendars, the first time a timezone is encountered, its name is recorded in__tzidMap
so that the timezone can later be discovered by name.This is problematic because
registerTzinfo()
remembers the first instance, and not the most recent instance:This means that in subsequent calendars contrary to its name
registerTzinfo()
does not register the instance, and agetTzid()
actually retrieves the first instance that was encountered much earlier.One scenario where this can be a problem is where calendar is ingested using
readOne()
containing some potentially arbitrary VTIMEZONE. After this a new calendar is created, and rather than using the definitive timezone information from pytz, instead uses the information read from the first calendar obtained via__tzidMap
.