1.1 --- a/imiptools/data.py Mon Oct 05 23:53:38 2015 +0200
1.2 +++ b/imiptools/data.py Mon Oct 05 23:56:48 2015 +0200
1.3 @@ -28,7 +28,8 @@
1.4 get_datetime_tzid, \
1.5 get_duration, get_period, get_period_item, \
1.6 get_recurrence_start_point, \
1.7 - get_tzid, to_datetime, to_timezone, to_utc_datetime
1.8 + get_time, get_tzid, to_datetime, to_timezone, \
1.9 + to_utc_datetime
1.10 from imiptools.period import FreeBusyPeriod, Period, RecurringPeriod, period_overlaps
1.11 from vCalendar import iterwrite, parse, ParseError, to_dict, to_node
1.12 from vRecurrence import get_parameters, get_rule
1.13 @@ -419,6 +420,24 @@
1.14
1.15 return old_values != set(self.get_date_values("RDATE") or [])
1.16
1.17 + def update_dtstamp(self):
1.18 +
1.19 + "Update the DTSTAMP in the object."
1.20 +
1.21 + dtstamp = self.get_utc_datetime("DTSTAMP")
1.22 + utcnow = get_time()
1.23 + dtstamp = format_datetime(dtstamp and dtstamp > utcnow and dtstamp or utcnow)
1.24 + self["DTSTAMP"] = [(dtstamp, {})]
1.25 + return dtstamp
1.26 +
1.27 + def update_sequence(self, increment=False):
1.28 +
1.29 + "Set or update the SEQUENCE in the object."
1.30 +
1.31 + sequence = self.get_value("SEQUENCE") or "0"
1.32 + self["SEQUENCE"] = [(str(int(sequence) + (increment and 1 or 0)), {})]
1.33 + return sequence
1.34 +
1.35 def update_exceptions(self, excluded):
1.36
1.37 """