# HG changeset patch # User Paul Boddie # Date 1515780673 -3600 # Node ID 564a684025ff99a1ed0adebdc1c4204642c329a2 # Parent b2af2d6aff53b928899c051136910185e664ad95 Prevent objects constructed for ADD method updates from employing RECURRENCE-ID. diff -r b2af2d6aff53 -r 564a684025ff imiptools/client.py --- a/imiptools/client.py Sat Dec 16 22:44:26 2017 +0100 +++ b/imiptools/client.py Fri Jan 12 19:11:13 2018 +0100 @@ -859,9 +859,9 @@ # Specific message generation methods. - def get_rescheduled_objects(self, periods): + def get_rescheduled_objects(self, periods, method): - "Return objects describing rescheduled 'periods'." + "Return objects describing rescheduled 'periods' for 'method'." objects = [] @@ -890,12 +890,16 @@ if not obj: obj = template.copy() - # Acquire the original recurrence identifier associated with - # this period. This may differ where the start of the period - # has changed. + # Added methods do not employ a recurrence identifier. + + if method != "ADD": - dt, attr = p.get_recurrenceid_item() - obj["RECURRENCE-ID"] = [(format_datetime(dt), attr)] + # Acquire the original recurrence identifier associated with + # this period. This may differ where the start of the period + # has changed. + + dt, attr = p.get_recurrenceid_item() + obj["RECURRENCE-ID"] = [(format_datetime(dt), attr)] # Update any sequence number if the period has changed from any # stored version. @@ -924,7 +928,7 @@ rescheduled_parts = [] - for obj in self.get_rescheduled_objects(periods): + for obj in self.get_rescheduled_objects(periods, method): rescheduled_parts.append(self.object_to_part(method, obj)) return rescheduled_parts