1.1 --- a/imiptools/period.py Sun May 17 18:00:09 2015 +0200
1.2 +++ b/imiptools/period.py Sun May 17 18:07:14 2015 +0200
1.3 @@ -126,6 +126,30 @@
1.4 def __repr__(self):
1.5 return "FreeBusyPeriod(%r)" % (self.as_tuple(),)
1.6
1.7 +class RecurringPeriod(Period):
1.8 +
1.9 + "A period with iCalendar attribute and origin information from the object."
1.10 +
1.11 + def __init__(self, start, end, tzid=None, origin=None, start_attr=None, end_attr=None):
1.12 + Period.__init__(self, start, end, tzid, origin)
1.13 + self.start_attr = start_attr
1.14 + self.end_attr = end_attr
1.15 +
1.16 + def get_start_item(self):
1.17 + return self.start, self.start_attr
1.18 +
1.19 + def get_end_item(self):
1.20 + return self.end, self.end_attr
1.21 +
1.22 + def get_tzid(self):
1.23 + return get_tzid(self.start_attr, self.end_attr) or self.tzid
1.24 +
1.25 + def as_tuple(self):
1.26 + return self.start, self.end, self.tzid, self.origin, self.start_attr, self.end_attr
1.27 +
1.28 + def __repr__(self):
1.29 + return "RecurringPeriod(%r)" % (self.as_tuple(),)
1.30 +
1.31 # Time and period management.
1.32
1.33 def can_schedule(freebusy, periods, uid, recurrenceid):