1.1 --- a/imiptools/content.py Wed Mar 04 18:03:35 2015 +0100
1.2 +++ b/imiptools/content.py Thu Mar 05 15:26:50 2015 +0100
1.3 @@ -242,7 +242,12 @@
1.4 self.update_freebusy_for_participant(freebusy, periods, participant_attr,
1.5 for_organiser and self.is_not_attendee(participant, self.obj))
1.6
1.7 - self.remove_freebusy_for_original_recurrence(freebusy)
1.8 + # Subtract any recurrences from the free/busy details of a parent
1.9 + # object.
1.10 +
1.11 + for recurrenceid in self.store.get_recurrences(user, self.uid):
1.12 + remove_affected_period(freebusy, self.uid, recurrenceid)
1.13 +
1.14 self.store.set_freebusy_for_other(user, freebusy, participant)
1.15
1.16 def update_freebusy_from_organiser(self, attendee, organiser_item):
1.17 @@ -511,53 +516,6 @@
1.18 sequence = self.obj.get_value("SEQUENCE") or "0"
1.19 self.obj["SEQUENCE"] = [(str(int(sequence) + (increment and 1 or 0)), {})]
1.20
1.21 - def detach_recurrence(self, identity):
1.22 -
1.23 - "Detach the current object from its parent if it is a recurrence."
1.24 -
1.25 - # Where a recurring object is updated by a specific occurrence, the
1.26 - # details of the recurring "parent" must be changed.
1.27 -
1.28 - obj = self.get_parent_object(identity)
1.29 - if not obj:
1.30 - return
1.31 -
1.32 - # The original recurrence is obtained, although the recurrence
1.33 - # identifier could be converted back to a UTC datetime and used
1.34 - # instead.
1.35 -
1.36 - recurrence = self.obj.get_datetime("RECURRENCE-ID")
1.37 - if not obj.has_recurrence(self.get_tzid(identity), recurrence):
1.38 - return
1.39 -
1.40 - # To detach the occurrence, the exceptions to the defined recurrence are
1.41 - # modified.
1.42 -
1.43 - item = obj.get_item("EXDATE")
1.44 - if item:
1.45 - exdates, exdate_attr = item
1.46 - if not isinstance(exdates, list):
1.47 - exdates = [exdates]
1.48 - else:
1.49 - exdates, exdate_attr = [], {}
1.50 -
1.51 - # Convert the occurrence to the same time regime as the other
1.52 - # exceptions.
1.53 -
1.54 - exdate_tzid = exdate_attr.get("TZID")
1.55 - exdate = recurrence
1.56 - if exdate_tzid:
1.57 - exdate = to_timezone(exdate, exdate_tzid)
1.58 - else:
1.59 - exdate = to_timezone(exdate, "UTC")
1.60 -
1.61 - # Update the exceptions and store the modified parent event.
1.62 -
1.63 - exdates.append(format_datetime(exdate))
1.64 - obj["EXDATE"] = [(exdates, exdate_attr)]
1.65 -
1.66 - self.store.set_event(identity, self.uid, None, obj.to_node())
1.67 -
1.68 def get_tzid(self, identity):
1.69
1.70 "Return the time regime applicable for the given 'identity'."