Fix handling of non-unique VTIMEZONEs.

We should probably choose a better system for generating unique TZNAMEs.
pull/228/head
Christian Geier 2017-05-26 14:07:59 +02:00
rodzic 2e8311ba0a
commit d445fcf87c
2 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -17,6 +17,11 @@ Bug fixes:
- added an assertion that VTIMEZONE sub-components' DTSTART must be of type
DATETIME [geier]
- Fix handling of VTIMEZONEs with subcomponents with the same DTSTARTs and
OFFSETs but which are of different types [geier]
- *add item here*
3.11.4 (2017-05-10)
-------------------

Wyświetl plik

@ -572,6 +572,7 @@ class Timezone(Component):
zone = str(self['TZID'])
transitions = []
dst = {}
tznames = set()
for component in self.walk():
if type(component) == Timezone:
continue
@ -587,6 +588,11 @@ class Timezone(Component):
component['TZOFFSETFROM'].to_ical(), # for whatever reason this is str/unicode
component['TZOFFSETTO'].to_ical(), # for whatever reason this is str/unicode
)
# TODO better way of making sure tznames are unique
while tzname in tznames:
tzname += '_1'
tznames.add(tzname)
dst[tzname], component_transitions = self._extract_offsets(
component, tzname
)