1.1 --- a/tools/make_freebusy.py Mon May 18 15:08:29 2015 +0200
1.2 +++ b/tools/make_freebusy.py Mon May 18 17:13:46 2015 +0200
1.3 @@ -2,7 +2,7 @@
1.4
1.5 from imiptools.data import get_window_end, Object
1.6 from imiptools.dates import format_datetime, get_default_timezone, to_recurrence_start
1.7 -from imiptools.period import FreeBusyPeriod
1.8 +from imiptools.period import FreeBusyPeriod, is_replaced
1.9 from imiptools.profile import Preferences
1.10 from imip_store import FileStore, FilePublisher
1.11 import sys
1.12 @@ -11,18 +11,20 @@
1.13
1.14 # Update free/busy details with the actual periods associated with the event.
1.15
1.16 - recurrenceid = format_datetime(obj.get_utc_datetime("RECURRENCE-ID")) or ""
1.17 - recurrenceids = [to_recurrence_start(r, tzid) for r in recurrenceids]
1.18 + recurrenceid = obj.get_recurrenceid()
1.19 + recurrenceids = [to_recurrence_start(r) for r in recurrenceids]
1.20
1.21 - for p in obj.get_periods_for_freebusy(tzid, window_end):
1.22 - if recurrenceid or p.start not in recurrenceids:
1.23 + for p in obj.get_periods(tzid, window_end):
1.24 + if recurrenceid or not is_replaced(p, recurrenceids, tzid):
1.25 fb.append(FreeBusyPeriod(
1.26 - p.start, p.end,
1.27 + p.get_start(),
1.28 + p.get_end(),
1.29 obj.get_value("UID"),
1.30 only_organiser and "ORG" or obj.get_value("TRANSP") or "OPAQUE",
1.31 recurrenceid,
1.32 obj.get_value("SUMMARY"),
1.33 - obj.get_value("ORGANIZER")
1.34 + obj.get_value("ORGANIZER"),
1.35 + p.get_tzid()
1.36 ))
1.37
1.38 # Main program.
1.39 @@ -120,6 +122,6 @@
1.40 store.set_freebusy_for_other(user, fb, participant)
1.41 else:
1.42 for item in fb:
1.43 - print "\t".join(item.as_tuple())
1.44 + print "\t".join(item.as_tuple(strings_only=True))
1.45
1.46 # vim: tabstop=4 expandtab shiftwidth=4