1.1 --- a/imiptools/data.py Wed Jul 29 16:39:08 2015 +0200
1.2 +++ b/imiptools/data.py Wed Jul 29 16:40:28 2015 +0200
1.3 @@ -425,9 +425,12 @@
1.4 def get_periods(obj, tzid, window_end, inclusive=False):
1.5
1.6 """
1.7 - Return periods for the given object 'obj', confining materialised periods
1.8 - to before the given 'window_end' datetime. If 'inclusive' is set to a true
1.9 - value, any period occurring at the 'window_end' will be included.
1.10 + Return periods for the given object 'obj', employing the given 'tzid' where
1.11 + no time zone information is available (for whole day events, for example),
1.12 + confining materialised periods to before the given 'window_end' datetime.
1.13 +
1.14 + If 'inclusive' is set to a true value, any period occurring at the
1.15 + 'window_end' will be included.
1.16 """
1.17
1.18 rrule = obj.get_value("RRULE")
1.19 @@ -446,6 +449,9 @@
1.20 else:
1.21 dtend, dtend_attr = dtstart, dtstart_attr
1.22
1.23 + # Attempt to get time zone details from the object, using the supplied zone
1.24 + # only as a fallback.
1.25 +
1.26 tzid = obj.get_tzid() or tzid
1.27
1.28 if not rrule:
1.29 @@ -526,10 +532,13 @@
1.30
1.31 return senders
1.32
1.33 -# NOTE: Need to expose the 100 day window for recurring events in the
1.34 -# NOTE: configuration.
1.35 +def get_window_end(tzid, days=100):
1.36
1.37 -def get_window_end(tzid, window_size=100):
1.38 - return to_timezone(datetime.now(), tzid) + timedelta(window_size)
1.39 + """
1.40 + Return a datetime in the time zone indicated by 'tzid' marking the end of a
1.41 + window of the given number of 'days'.
1.42 + """
1.43 +
1.44 + return to_timezone(datetime.now(), tzid) + timedelta(days)
1.45
1.46 # vim: tabstop=4 expandtab shiftwidth=4