def gettzinfo(self):
# workaround for dateutil failing to parse some experimental properties
good_lines = ('rdate', 'rrule', 'dtstart', 'tzname', 'tzoffsetfrom',
'tzoffsetto', 'tzid')
# serialize encodes as utf-8, cStringIO will leave utf-8 alone
buffer = six.StringIO()
# allow empty VTIMEZONEs
if len(self.contents) == 0:
return None
def customSerialize(obj):
if isinstance(obj, Component):
foldOneLine(buffer, u"BEGIN:" + obj.name)
for child in obj.lines():
if child.name.lower() in good_lines:
child.serialize(buffer, 75, validate=False)
for comp in obj.components():
customSerialize(comp)
foldOneLine(buffer, u"END:" + obj.name)
customSerialize(self)
buffer.seek(0) # tzical wants to read a stream
return tz.tzical(buffer).get()
评论列表
文章目录