import description in event text, in html

This commit is contained in:
Frédéric Péters 2011-11-29 18:29:56 +01:00
parent 0952ad0ec4
commit 15654ab25f
1 changed files with 15 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from Products.CMFCore.WorkflowCore import WorkflowException
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView
from plone.registry.interfaces import IRegistry
from plone.app.textfield.value import RichTextValue
from tabellio.config.interfaces import ITabellioSettings
@ -57,10 +58,23 @@ class IcalImport(BrowserView):
event.title = title
event.start = date_start
event.end = date_end
description = None
try:
event.description = vevent.description.value
description = vevent.description.value
except:
pass
if description:
event.text = RichTextValue(raw=description,
mimeType='text/plain', outputMimeType='text/x-html-safe')
description = None
try:
description = vevent.x_alt_desc.value
except:
pass
if description:
event.text = RichTextValue(raw=description,
mimeType='text/html', outputMimeType='text/x-html-safe')
try:
event.location = vevent.location.value
except: