1.1 --- a/imiptools/data.py Sun May 17 17:16:23 2015 +0200
1.2 +++ b/imiptools/data.py Sun May 17 17:59:06 2015 +0200
1.3 @@ -411,8 +411,8 @@
1.4
1.5 "A period with origin information from the object."
1.6
1.7 - def __init__(self, start, end, origin, start_attr=None, end_attr=None):
1.8 - Period.__init__(self, start, end, origin)
1.9 + def __init__(self, start, end, tzid=None, origin=None, start_attr=None, end_attr=None):
1.10 + Period.__init__(self, start, end, tzid, origin)
1.11 self.start_attr = start_attr
1.12 self.end_attr = end_attr
1.13
1.14 @@ -423,13 +423,13 @@
1.15 return self.end, self.end_attr
1.16
1.17 def get_tzid(self):
1.18 - return get_tzid(self.start_attr, self.end_attr)
1.19 + return get_tzid(self.start_attr, self.end_attr) or self.tzid
1.20
1.21 def as_tuple(self):
1.22 - return self.start, self.end, self.origin, self.start_attr, self.end_attr
1.23 + return self.start, self.end, self.tzid, self.origin, self.start_attr, self.end_attr
1.24
1.25 def __repr__(self):
1.26 - return "RecurringPeriod(%r, %r, %r, %r, %r)" % (self.start, self.end, self.origin, self.start_attr, self.end_attr)
1.27 + return "RecurringPeriod(%r)" % (self.as_tuple(),)
1.28
1.29 def get_periods(obj, tzid, window_end, inclusive=False):
1.30
1.31 @@ -458,7 +458,7 @@
1.32 tzid = get_tzid(dtstart_attr, dtend_attr) or tzid
1.33
1.34 if not rrule:
1.35 - periods = [RecurringPeriod(dtstart, dtend, "DTSTART", dtstart_attr, dtend_attr)]
1.36 + periods = [RecurringPeriod(dtstart, dtend, tzid, "DTSTART", dtstart_attr, dtend_attr)]
1.37 else:
1.38 # Recurrence rules create multiple instances to be checked.
1.39 # Conflicts may only be assessed within a period defined by policy
1.40 @@ -477,7 +477,7 @@
1.41 for start in selector.materialise(dtstart, window_end, parameters.get("COUNT"), parameters.get("BYSETPOS"), inclusive):
1.42 start = to_timezone(datetime(*start), tzid)
1.43 end = start + duration
1.44 - periods.append(RecurringPeriod(start, end, "RRULE"))
1.45 + periods.append(RecurringPeriod(start, end, tzid, "RRULE"))
1.46
1.47 # Add recurrence dates.
1.48
1.49 @@ -486,9 +486,9 @@
1.50 if rdates:
1.51 for rdate, rdate_attr in rdates:
1.52 if isinstance(rdate, tuple):
1.53 - periods.append(RecurringPeriod(rdate[0], rdate[1], "RDATE", rdate_attr))
1.54 + periods.append(RecurringPeriod(rdate[0], rdate[1], tzid, "RDATE", rdate_attr))
1.55 else:
1.56 - periods.append(RecurringPeriod(rdate, rdate + duration, "RDATE", rdate_attr))
1.57 + periods.append(RecurringPeriod(rdate, rdate + duration, tzid, "RDATE", rdate_attr))
1.58
1.59 # Return a sorted list of the periods.
1.60