1.1 --- a/imiptools/client.py Fri Sep 11 13:40:39 2015 +0200
1.2 +++ b/imiptools/client.py Fri Sep 11 15:49:33 2015 +0200
1.3 @@ -268,6 +268,12 @@
1.4 self.sequence = obj and self.obj.get_value("SEQUENCE")
1.5 self.dtstamp = obj and self.obj.get_value("DTSTAMP")
1.6
1.7 + def is_usable(self):
1.8 +
1.9 + "Return whether the current object is usable."
1.10 +
1.11 + return True
1.12 +
1.13 # Object update methods.
1.14
1.15 def update_recurrenceid(self):
1.16 @@ -286,7 +292,7 @@
1.17
1.18 dtstamp = self.obj.get_utc_datetime("DTSTAMP")
1.19 utcnow = to_timezone(datetime.utcnow(), "UTC")
1.20 - self.dtstamp = format_datetime(dtstamp > utcnow and dtstamp or utcnow)
1.21 + self.dtstamp = format_datetime(dtstamp and dtstamp > utcnow and dtstamp or utcnow)
1.22 self.obj["DTSTAMP"] = [(self.dtstamp, {})]
1.23
1.24 def set_sequence(self, increment=False):
2.1 --- a/imiptools/content.py Fri Sep 11 13:40:39 2015 +0200
2.2 +++ b/imiptools/content.py Fri Sep 11 15:49:33 2015 +0200
2.3 @@ -69,7 +69,8 @@
2.4 # Dispatch to a handler and obtain any response.
2.5
2.6 handler.set_object(Object({name : item}))
2.7 - methods[method](handler)()
2.8 + if handler.is_usable():
2.9 + methods[method](handler)()
2.10
2.11 # Handler registry.
2.12
3.1 --- a/imiptools/data.py Fri Sep 11 13:40:39 2015 +0200
3.2 +++ b/imiptools/data.py Fri Sep 11 15:49:33 2015 +0200
3.3 @@ -648,6 +648,7 @@
3.4 """
3.5 Return the value provided by 'd' for 'name' as a datetime in the UTC zone
3.6 or as a date, converting any date to a datetime if 'date_tzid' is specified.
3.7 + If no datetime or date is available, None is returned.
3.8 """
3.9
3.10 t = get_datetime_item(d, name)
3.11 @@ -655,7 +656,7 @@
3.12 return None
3.13 else:
3.14 dt, attr = t
3.15 - return to_utc_datetime(dt, date_tzid)
3.16 + return dt is not None and to_utc_datetime(dt, date_tzid) or None
3.17
3.18 def get_datetime_item(d, name):
3.19
4.1 --- a/imiptools/handlers/common.py Fri Sep 11 13:40:39 2015 +0200
4.2 +++ b/imiptools/handlers/common.py Fri Sep 11 15:49:33 2015 +0200
4.3 @@ -70,6 +70,12 @@
4.4
4.5 "Common outgoing message handling functionality mix-in."
4.6
4.7 + def is_usable(self):
4.8 +
4.9 + "Return whether the current object is usable."
4.10 +
4.11 + return self.obj and self.obj.get_value("DTSTART")
4.12 +
4.13 def update_event_in_freebusy(self, for_organiser=True):
4.14
4.15 """