1.1 --- a/imiptools/client.py Fri Jan 19 19:26:36 2018 +0100
1.2 +++ b/imiptools/client.py Sat Jan 20 17:41:23 2018 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Common calendar client utilities.
1.6
1.7 -Copyright (C) 2014, 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2014, 2015, 2016, 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -867,13 +867,6 @@
1.13
1.14 if periods:
1.15
1.16 - # For new recurrences, duplicate the core of the object without any
1.17 - # period information.
1.18 -
1.19 - template = self.obj.copy()
1.20 - template.remove_all(["EXDATE", "RRULE", "RDATE", "DTSTART", "DTEND",
1.21 - "DURATION"])
1.22 -
1.23 # Process each period, attempting to update existing recurrences or
1.24 # creating new ones.
1.25
1.26 @@ -885,21 +878,13 @@
1.27
1.28 obj = self.get_stored_object(self.uid, p.get_recurrenceid())
1.29
1.30 - # Use the template without an existing recurrence.
1.31 + # Make a new separate recurrence if necessary.
1.32
1.33 if not obj:
1.34 - obj = template.copy()
1.35
1.36 # Added methods do not employ a recurrence identifier.
1.37
1.38 - if method != "ADD":
1.39 -
1.40 - # Acquire the original recurrence identifier associated with
1.41 - # this period. This may differ where the start of the period
1.42 - # has changed.
1.43 -
1.44 - dt, attr = p.get_recurrenceid_item()
1.45 - obj["RECURRENCE-ID"] = [(format_datetime(dt), attr)]
1.46 + obj = self.obj.make_recurrence(p, method != "ADD")
1.47
1.48 # Update any sequence number if the period has changed from any
1.49 # stored version.
1.50 @@ -911,10 +896,10 @@
1.51 if main != p:
1.52 self.update_sequence(obj)
1.53
1.54 - # Set specific recurrence information.
1.55 + # Set specific recurrence information.
1.56
1.57 - obj.set_datetime("DTSTART", p.get_start())
1.58 - obj.set_datetime("DTEND", p.get_end())
1.59 + obj.set_datetime("DTSTART", p.get_start())
1.60 + obj.set_datetime("DTEND", p.get_end())
1.61
1.62 objects.append(obj)
1.63