Annotation of kupuMPIWG/plone/kupu2html.py, revision 1.1
1.1 ! dwinter 1: # Portal transform for images with captions
! 2: #
! 3: # Transforming a non-standard field type to html on output is
! 4: # probably a better way to do things than the original transform
! 5: # which converts html to a non-standard field type.
! 6: #
! 7: # The transform is the same as the one done by html2captioned, but
! 8: # this version expects to work on text/x-html-raw
! 9:
! 10: from Products.CMFCore.utils import getToolByName
! 11: from Products.PortalTransforms.interfaces import itransform
! 12: from Products.kupu.plone import html2captioned
! 13:
! 14: class KupuOutputTransform(html2captioned.HTMLToCaptioned):
! 15: """Transform which adds captions to images embedded in HTML"""
! 16: __implements__ = itransform
! 17: __name__ = "kupu_raw_to_html"
! 18: inputs = ('text/x-html-raw',)
! 19: output = "text/html"
! 20:
! 21: def register():
! 22: return KupuOutputTransform()
! 23:
! 24: def initialize():
! 25: engine = getToolByName(portal, 'portal_transforms')
! 26: engine.registerTransform(register())
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>