1.1 --- a/imiptools/period.py Thu Sep 03 19:00:50 2015 +0200
1.2 +++ b/imiptools/period.py Thu Sep 03 19:07:13 2015 +0200
1.3 @@ -209,6 +209,31 @@
1.4 def __repr__(self):
1.5 return "FreeBusyPeriod%r" % (self.as_tuple(),)
1.6
1.7 + # Period and event recurrence logic.
1.8 +
1.9 + def is_replaced(self, recurrences):
1.10 +
1.11 + """
1.12 + Return whether this period refers to one of the 'recurrences'.
1.13 + The 'recurrences' must be UTC datetimes corresponding to the start of
1.14 + the period described by a recurrence.
1.15 + """
1.16 +
1.17 + for recurrence in recurrences:
1.18 + if self.is_affected(recurrence):
1.19 + return True
1.20 + return False
1.21 +
1.22 + def is_affected(self, recurrence):
1.23 +
1.24 + """
1.25 + Return whether this period refers to 'recurrence'. The 'recurrence' must
1.26 + be a UTC datetime corresponding to the start of the period described by
1.27 + a recurrence.
1.28 + """
1.29 +
1.30 + return recurrence and self.get_start_point() == recurrence
1.31 +
1.32 class RecurringPeriod(Period):
1.33
1.34 """