imip-agent

Change of imiptools/data.py

616:3e15d3953066
imiptools/data.py
     1.1 --- a/imiptools/data.py	Tue Jul 28 19:27:27 2015 +0200
     1.2 +++ b/imiptools/data.py	Wed Jul 29 00:18:59 2015 +0200
     1.3 @@ -22,9 +22,9 @@
     1.4  from bisect import bisect_left
     1.5  from datetime import date, datetime, timedelta
     1.6  from email.mime.text import MIMEText
     1.7 -from imiptools.dates import format_datetime, get_datetime, get_duration, \
     1.8 -                            get_freebusy_period, get_period, get_tzid, \
     1.9 -                            to_timezone, to_utc_datetime
    1.10 +from imiptools.dates import format_datetime, get_datetime, get_datetime_tzid, \
    1.11 +                            get_duration, get_freebusy_period, get_period, \
    1.12 +                            get_tzid, to_timezone, to_utc_datetime
    1.13  from imiptools.period import Period, RecurringPeriod, period_overlaps
    1.14  from vCalendar import iterwrite, parse, ParseError, to_dict, to_node
    1.15  from vRecurrence import get_parameters, get_rule
    1.16 @@ -367,8 +367,9 @@
    1.17      else:
    1.18          value, attr = t
    1.19          dt = get_datetime(value, attr)
    1.20 -        if dt.tzname() == "UTC":
    1.21 -            attr["TZID"] = "UTC"
    1.22 +        tzid = get_datetime_tzid(dt)
    1.23 +        if tzid:
    1.24 +            attr["TZID"] = tzid
    1.25          return dt, attr
    1.26  
    1.27  # Conversion functions.