1.1 --- a/imiptools/data.py Sun Oct 18 13:56:13 2015 +0200
1.2 +++ b/imiptools/data.py Sun Oct 18 17:32:02 2015 +0200
1.3 @@ -424,6 +424,39 @@
1.4
1.5 return main_changed or old_values != set(self.get_date_values("RDATE") or [])
1.6
1.7 + def set_rule(self, rule):
1.8 +
1.9 + """
1.10 + Set the given 'rule' in this object, replacing the previous RRULE
1.11 + property, returning whether the object has changed. The provided 'rule'
1.12 + must be an item.
1.13 + """
1.14 +
1.15 + if not rule:
1.16 + return False
1.17 +
1.18 + old_rrule = self.get_item("RRULE")
1.19 + self["RRULE"] = [rule]
1.20 + return old_rrule != rule
1.21 +
1.22 + def set_exceptions(self, exceptions):
1.23 +
1.24 + """
1.25 + Set the given 'exceptions' in this object, replacing the previous EXDATE
1.26 + properties, returning whether the object has changed. The provided
1.27 + 'exceptions' must be a collection of items.
1.28 + """
1.29 +
1.30 + old_exdates = set(self.get_date_values("EXDATE") or [])
1.31 + if exceptions:
1.32 + self["EXDATE"] = exceptions
1.33 + return old_exdates != set(self.get_date_values("EXDATE") or [])
1.34 + elif old_exdates:
1.35 + del self["EXDATE"]
1.36 + return True
1.37 + else:
1.38 + return False
1.39 +
1.40 def update_dtstamp(self):
1.41
1.42 "Update the DTSTAMP in the object."