# HG changeset patch # User Paul Boddie # Date 1423058027 -3600 # Node ID 1c2242bd5de420d3cda24131907df086b1076595 # Parent f506b093407b723d028178659e82a12ad31f832b Changed get_datetime_item to require a time regime since the tzname method of datetimes is useless for the purpose of obtaining anything other than a specific time zone. diff -r f506b093407b -r 1c2242bd5de4 imip_manager.py --- a/imip_manager.py Tue Feb 03 23:40:24 2015 +0100 +++ b/imip_manager.py Wed Feb 04 14:53:47 2015 +0100 @@ -424,8 +424,8 @@ start = get_datetime(start, {"TZID" : tzid}) end = end and get_datetime(end, {"TZID" : tzid}) or get_start_of_next_day(start, tzid) - start_value, start_attr = get_datetime_item(start) - end_value, end_attr = get_datetime_item(end) + start_value, start_attr = get_datetime_item(start, tzid) + end_value, end_attr = get_datetime_item(end, tzid) # Create a calendar object and store it as a request. diff -r f506b093407b -r 1c2242bd5de4 imiptools/dates.py --- a/imiptools/dates.py Tue Feb 03 23:40:24 2015 +0100 +++ b/imiptools/dates.py Wed Feb 04 14:53:47 2015 +0100 @@ -85,14 +85,14 @@ else: return dt.strftime("%Y%m%d") -def get_datetime_item(dt): +def get_datetime_item(dt, tzid): - "Return an iCalendar-compatible string and attributes for 'dt'." + "Return an iCalendar-compatible string and attributes for 'dt' and 'tzid'." if not dt: return None, None value = format_datetime(dt) - attr = isinstance(dt, datetime) and {"TZID" : dt.tzname(), "VALUE" : "DATE-TIME"} or {"VALUE" : "DATE"} + attr = isinstance(dt, datetime) and {"TZID" : tzid, "VALUE" : "DATE-TIME"} or {"VALUE" : "DATE"} return value, attr def get_datetime(value, attr=None):