# HG changeset patch # User Paul Boddie # Date 1505759805 -7200 # Node ID 08a85ebe2399dd30c19cca004c957bcb1c53a637 # Parent 32d5819bb6ae0e9d379f1cc1ce1aa2dda4aa8f63# Parent 0fff3a8647bc49af7e49026a22cc93b87e61d0ac Merged changes from the default branch. diff -r 32d5819bb6ae -r 08a85ebe2399 imiptools/data.py --- a/imiptools/data.py Mon Sep 18 20:34:43 2017 +0200 +++ b/imiptools/data.py Mon Sep 18 20:36:45 2017 +0200 @@ -658,6 +658,23 @@ return ("VFREEBUSY", {}, record) +def parse_calendar(f, encoding): + + """ + Parse the iTIP content from 'f' having the given 'encoding'. Return a + mapping from object types to collections of calendar objects. + """ + + cal = parse_object(f, encoding, "VCALENDAR") + d = {} + + for objtype, values in cal.items(): + d[objtype] = l = [] + for value in values: + l.append(Object({objtype : value})) + + return d + def parse_object(f, encoding, objtype=None): """