Annotation of kupuMPIWG/plone/kupu_plone_layer/convertContentForKupu.py, revision 1.1.1.1
1.1 dwinter 1: ## Script (Python) "convertContentForKupu"
2: ##title=Convert content to HTML for editing with Kupu
3: ##bind container=container
4: ##bind context=context
5: ##bind namespace=
6: ##bind script=script
7: ##bind subpath=traverse_subpath
8: ##parameters=fieldname, content
9: from Products.CMFCore.utils import getToolByName
10: from Products.PythonScripts.standard import structured_text, newline_to_br
11:
12: field = context.getField(fieldname)
13: text_format = context.REQUEST.get('%s_text_format' % fieldname, context.getContentType(fieldname))
14:
15: if len(content)==0 or 'html' in text_format.lower():
16: return content
17:
18: transforms = getToolByName(context, 'portal_transforms')
19: return transforms.convertTo('text/html', content, mimetype=text_format)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>