[schema] default_workflow_of more naturally expressed as default_workflow
"""mime type transformation engine for cubicweb, based on mtconverter:organization: Logilab:copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses"""__docformat__="restructuredtext en"fromlogilabimportmtconverterfromlogilab.mtconverter.engineimportTransformEnginefromlogilab.mtconverter.transformimportTransformfromcubicweb.common.uilibimportrest_publish,html_publish,remove_html_tagsHTML_MIMETYPES=('text/html','text/xhtml','application/xhtml+xml')# CubicWeb specific transformationsclassrest_to_html(Transform):inputs=('text/rest','text/x-rst')output='text/html'def_convert(self,trdata):returnrest_publish(trdata.appobject,trdata.decode())classhtml_to_html(Transform):inputs=HTML_MIMETYPESoutput='text/html'def_convert(self,trdata):returnhtml_publish(trdata.appobject,trdata.data)# Instantiate and configure the transformation enginemtconverter.UNICODE_POLICY='replace'ENGINE=TransformEngine()ENGINE.add_transform(rest_to_html())ENGINE.add_transform(html_to_html())HAS_PIL_TRANSFORMS=FalseHAS_PYGMENTS_TRANSFORMS=Falseclasshtml_to_text(Transform):inputs=HTML_MIMETYPESoutput='text/plain'def_convert(self,trdata):returnremove_html_tags(trdata.data)ENGINE.add_transform(html_to_text())