# HG changeset patch # User Paul Boddie # Date 1505254282 -7200 # Node ID 3247e43c0af89512d200adcc4a7be0f7f4fd4df6 # Parent 0b18f5594278372e4a35835f72698e2f4319aedb# Parent 19a3de939b452ca3759ce9fcd201582024cdf2a7 Merged changes from concurrent branch. Moved the affected function. diff -r 0b18f5594278 -r 3247e43c0af8 imipweb/event.py --- a/imipweb/event.py Tue Sep 12 23:07:14 2017 +0200 +++ b/imipweb/event.py Wed Sep 13 00:11:22 2017 +0200 @@ -1035,6 +1035,43 @@ origin_name="recur-origin", replaced_name="recur-replaced", tzid=self.get_tzid()) + def get_removed_periods(self, periods): + + """ + From the recurrence 'periods' and information provided in the request, + return the remaining active periods, the periods to unschedule, and the + periods to exclude, in a tuple of the form (active, unscheduled, + excluded). + """ + + to_unschedule = set() + to_exclude = set() + + # Get all periods that are not replaced. + + active_periods = get_active_periods(periods) + + for period in self.get_state("recur-remove", list): + active_periods[period] -= 1 + + if not self.can_edit_recurrence(period) and self.is_organiser(): + l = to_unschedule + else: + l = to_exclude + l.add(period) + + # Determine whether some periods are both removed and added. + + remaining = [] + for period, n in active_periods.items(): + if n > 0: + remaining.append(period) + + to_unschedule.difference_update(remaining) + to_exclude.difference_update(remaining) + + return remaining, to_unschedule, to_exclude + def get_attendees_from_page(self): """ @@ -1205,42 +1242,6 @@ return self.get_state("remove", list) - def get_removed_periods(self, periods): - - """ - Return those from the recurrence 'periods' to remove upon updating an - event along with those to exclude in a tuple of the form (unscheduled, - excluded). - """ - - to_unschedule = set() - to_exclude = set() - - # Get all periods that are not replaced. - - active_periods = get_active_periods(periods) - - for period in self.get_state("recur-remove", list): - active_periods[period] -= 1 - - if not self.can_edit_recurrence(period) and self.is_organiser(): - l = to_unschedule - else: - l = to_exclude - l.add(period) - - # Determine whether some periods are both removed and added. - - remaining = [] - for period, n in active_periods.items(): - if n > 0: - remaining.append(period) - - to_unschedule.difference_update(remaining) - to_exclude.difference_update(remaining) - - return remaining, to_unschedule, to_exclude - # Full page output methods. def show(self, path_info):