parse locations set as email addresses by zimbra (#1093)
This commit is contained in:
parent
748738f6c7
commit
a8797a4ce8
|
@ -1,6 +1,9 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import urllib2
|
import urllib2
|
||||||
import vobject
|
import vobject
|
||||||
|
import rfc822
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.event import notify
|
from zope.event import notify
|
||||||
|
@ -57,6 +60,17 @@ class IcalImport(BrowserView):
|
||||||
except:
|
except:
|
||||||
pass
|
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_id = '%(year)04d%(month)02d%(day)02d'
|
||||||
base_parts = {'year': date_start.year,
|
base_parts = {'year': date_start.year,
|
||||||
'month': date_start.month,
|
'month': date_start.month,
|
||||||
|
|
Reference in New Issue