summaryrefslogtreecommitdiffstats
path: root/wallace/module_resources.py
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2014-03-04 16:14:50 -0500
committerThomas Bruederli <bruederli@kolabsys.com>2014-03-04 16:14:50 -0500
commit65df5988b84608386dd0b56c6e60e3eb9a67e83e (patch)
tree3e448eb37dc013679b3a2497d388e98d686d7394 /wallace/module_resources.py
parenta4c05082d6b365da9bc4ad138278d682bc1bce80 (diff)
downloadpykolab-65df5988b84608386dd0b56c6e60e3eb9a67e83e.tar.gz
Ignore invalid iTip messages but not fail on them
Diffstat (limited to 'wallace/module_resources.py')
-rw-r--r--wallace/module_resources.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index cf03520..3db2209 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -152,7 +152,11 @@ def execute(*args, **kw):
# An iTip message may contain multiple events. Later on, test if the message
# is an iTip message by checking the length of this list.
- itip_events = itip_events_from_message(message)
+ try:
+ itip_events = itip_events_from_message(message)
+ except Exception, e:
+ log.error(_("Failed to parse iTip events from message: %r" % (e)))
+ itip_events = []
if not len(itip_events) > 0:
log.info(
@@ -586,7 +590,7 @@ def itip_events_from_message(message):
seen_uids = []
# iTip methods we are actually interested in. Other methods will be ignored.
- itip_methods = [ "REQUEST", "REPLY", "ADD", "CANCEL" ]
+ itip_methods = [ "REQUEST", "CANCEL" ]
# Are all iTip messages multipart? No! RFC 6047, section 2.4 states "A
# MIME body part containing content information that conforms to this
@@ -600,11 +604,8 @@ def itip_events_from_message(message):
# But in real word, other mime-types are used as well
if part.get_content_type() in [ "text/calendar", "text/x-vcalendar", "application/ics" ]:
if not str(part.get_param('method')).upper() in itip_methods:
- log.error(
- _("Method %r not really interesting for us.") % (
- part.get_param('method')
- )
- )
+ log.error(_("Method %r not really interesting for us.") % (part.get_param('method')))
+ continue
# Get the itip_payload
itip_payload = part.get_payload(decode=True)