Changeset View
Changeset View
Standalone View
Standalone View
pykolab/itip/__init__.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | for part in message.walk(): | ||||
if part.get_content_type() in [ "text/calendar", "text/x-vcalendar", "application/ics" ]: | if part.get_content_type() in [ "text/calendar", "text/x-vcalendar", "application/ics" ]: | ||||
if not str(part.get_param('method')).upper() in methods: | if not str(part.get_param('method')).upper() in methods: | ||||
log.info(_("Method %r not really interesting for us.") % (part.get_param('method'))) | log.info(_("Method %r not really interesting for us.") % (part.get_param('method'))) | ||||
continue | continue | ||||
# Get the itip_payload | # Get the itip_payload | ||||
itip_payload = part.get_payload(decode=True) | itip_payload = part.get_payload(decode=True) | ||||
log.debug(_("Raw iTip payload (%r): %r") % (part.get_param('charset'), itip_payload), level=9) | log.debug(_("Raw iTip payload (%r): %r") % (part.get_param('charset'), itip_payload), level=8) | ||||
# Convert unsupported timezones, etc. | # Convert unsupported timezones, etc. | ||||
itip_payload = _convert_itip_payload(itip_payload) | itip_payload = _convert_itip_payload(itip_payload) | ||||
# Python iCalendar prior to 3.0 uses "from_string". | # Python iCalendar prior to 3.0 uses "from_string". | ||||
if hasattr(icalendar.Calendar, 'from_ical'): | if hasattr(icalendar.Calendar, 'from_ical'): | ||||
cal = icalendar.Calendar.from_ical(itip_payload) | cal = icalendar.Calendar.from_ical(itip_payload) | ||||
elif hasattr(icalendar.Calendar, 'from_string'): | elif hasattr(icalendar.Calendar, 'from_string'): | ||||
cal = icalendar.Calendar.from_string(itip_payload) | cal = icalendar.Calendar.from_string(itip_payload) | ||||
# If we can't read it, we're out | # If we can't read it, we're out | ||||
else: | else: | ||||
log.error(_("Could not read iTip from message.")) | log.error(_("Could not read iTip from message.")) | ||||
return [] | return [] | ||||
for c in cal.walk(): | for c in cal.walk(): | ||||
if c.name in objnames: | if c.name in objnames: | ||||
itip = {} | itip = {} | ||||
if c['uid'] in seen_uids: | if c['uid'] in seen_uids: | ||||
log.debug(_("Duplicate iTip object: %s") % (c['uid']), level=9) | log.debug(_("Duplicate iTip object: %s") % (c['uid']), level=8) | ||||
continue | continue | ||||
# From the event, take the following properties: | # From the event, take the following properties: | ||||
# | # | ||||
# - method | # - method | ||||
# - uid | # - uid | ||||
# - sequence | # - sequence | ||||
# - start | # - start | ||||
▲ Show 20 Lines • Show All 302 Lines • Show Last 20 Lines |