# HG changeset patch # User Paul Boddie # Date 1508535428 -7200 # Node ID 365abd0d41b484e383180860dd101f0e1ecf75a2 # Parent ecdbe127443aaadb257aeb8cf16a2ba4b3d16603# Parent 6975cdaac4a4c54debc18038ea94d3781f5330b5 Merged changes from the default branch. diff -r ecdbe127443a -r 365abd0d41b4 imiptools/data.py --- a/imiptools/data.py Fri Oct 20 23:11:15 2017 +0200 +++ b/imiptools/data.py Fri Oct 20 23:37:08 2017 +0200 @@ -1232,11 +1232,11 @@ return RecurringPeriod(start, end, tzid, "RRULE", attr) -def get_rule_periods(rrule, start, duration, attr, tzid, end, inclusive=False): +def get_rule_periods(rrule, main_period, tzid, end, inclusive=False): """ - Return periods for the given 'rrule', employing the 'start', 'duration', - datetime 'attr' and 'tzid'. + Return periods for the given 'rrule', employing the 'main_period' and + 'tzid'. The specified 'end' datetime indicates the end of the window for which periods shall be computed. @@ -1245,6 +1245,10 @@ will be included. """ + start = main_period.get_start() + attr = main_period.get_start_attr() + duration = main_period.get_duration() + parameters = rrule and get_parameters(rrule) selector = get_rule(start, rrule) @@ -1293,9 +1297,6 @@ main_period = obj.get_main_period() - dtstart = main_period.get_start() - dtstart_attr = main_period.get_start_attr() - if not rrule: periods = [main_period] @@ -1312,8 +1313,8 @@ selection_period = Period(start, None) periods = [] - for period in get_rule_periods(rrule, dtstart, - main_period.get_duration(), dtstart_attr, tzid, end, inclusive): + for period in get_rule_periods(rrule, main_period, tzid, end, + inclusive): # Use the main period where it occurs.