1.1 --- a/imiptools/dates.py Sun May 17 19:25:22 2015 +0200
1.2 +++ b/imiptools/dates.py Sun May 17 19:31:54 2015 +0200
1.3 @@ -431,13 +431,22 @@
1.4
1.5 return dtstart_attr and dtstart_attr.get("TZID") or dtend_attr and dtend_attr.get("TZID") or None
1.6
1.7 -def to_recurrence_start(recurrenceid, tzid):
1.8 +def get_recurrence_start(recurrenceid, tzid):
1.9
1.10 """
1.11 Return 'recurrenceid' in a form suitable for comparison with free/busy start
1.12 datetimes, using 'tzid' to convert recurrence identifiers that are dates.
1.13 """
1.14
1.15 - return format_datetime(to_utc_datetime(get_datetime(recurrenceid), tzid))
1.16 + return to_utc_datetime(get_datetime(recurrenceid), tzid)
1.17 +
1.18 +def to_recurrence_start(recurrenceid, tzid):
1.19 +
1.20 + """
1.21 + Return 'recurrenceid' in a form suitable for use as an unambiguous
1.22 + identifier, using 'tzid' to convert recurrence identifiers that are dates.
1.23 + """
1.24 +
1.25 + return format_datetime(get_recurrence_start(recurrenceid, tzid))
1.26
1.27 # vim: tabstop=4 expandtab shiftwidth=4
2.1 --- a/imipweb/event.py Sun May 17 19:25:22 2015 +0200
2.2 +++ b/imipweb/event.py Sun May 17 19:31:54 2015 +0200
2.3 @@ -22,8 +22,9 @@
2.4 from datetime import date, timedelta
2.5 from imiptools.client import update_attendees, update_participation
2.6 from imiptools.data import get_uri, uri_dict, uri_values
2.7 -from imiptools.dates import format_datetime, get_datetime, get_datetime_item, \
2.8 - get_period_item, to_date, to_datetime, to_timezone
2.9 +from imiptools.dates import format_datetime, get_datetime_item, \
2.10 + get_period_item, get_recurrence_start, to_date, \
2.11 + to_timezone
2.12 from imiptools.mail import Messenger
2.13 from imiptools.period import have_conflict
2.14 from imipweb.data import EventPeriod, \
2.15 @@ -65,16 +66,16 @@
2.16
2.17 def is_replaced(self, period, recurrenceids):
2.18 for s in recurrenceids:
2.19 - dt = to_timezone(get_datetime(s), self.get_tzid())
2.20 - if to_datetime(period.get_start(), self.get_tzid()) == dt:
2.21 + dt = get_recurrence_start(s, self.get_tzid())
2.22 + if period.get_start() == dt:
2.23 return s
2.24 return None
2.25
2.26 def is_affected(self, period, recurrenceid):
2.27 if not recurrenceid:
2.28 return None
2.29 - dt = to_timezone(get_datetime(recurrenceid), self.get_tzid())
2.30 - if to_datetime(period.get_start(), self.get_tzid()) == dt:
2.31 + dt = get_recurrence_start(recurrenceid, self.get_tzid())
2.32 + if period.get_start() == dt:
2.33 return recurrenceid
2.34 return None
2.35