parse locations set as email addresses by zimbra (#1093)

This commit is contained in:
Frédéric Péters 2011-12-01 18:12:40 +01:00
parent 748738f6c7
commit a8797a4ce8
1 changed files with 14 additions and 0 deletions

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
import datetime
import urllib2
import vobject
import rfc822
from zope import component
from zope.event import notify
@ -57,6 +60,17 @@ class IcalImport(BrowserView):
except:
pass
if location and '@' in location:
try:
location, email = rfc822.parseaddr(location)
except:
pass
if location:
# some special substitutions for PCF common locations
location = location.replace(u'HL ', u'Hôtel de Ligne - ')
location = location.replace(u'HG ', u'Hôtel du Greffe - ')
base_id = '%(year)04d%(month)02d%(day)02d'
base_parts = {'year': date_start.year,
'month': date_start.month,