def test_right_macro(self): # fixes #8016 class MyField: __name__ = 'the field' required = True default = u'the value' missing_value = None title = "" description = "" # Let's add a custom editor using our own widget html: from zope.pagetemplate.pagetemplatefile import PageTemplate template = PageTemplate() template.pt_edit(BODY, 'text/html') self.skins.custom.cool_editor_wysiwyg_support = template # The wysiwyg widget depends on the used editor. # Let's change it to `cool_editor`. pm = self.pm member = pm.getAuthenticatedMember() member.setMemberProperties({'wysiwyg_editor': 'cool_editor'}) w = WYSIWYGWidget(MyField(), self.request) # The test is partially that this call does not give an error: html = w() # This is true for standard Plone as well: self.assertIn( '<textarea name="field.the field" rows="25" id="field.the field">' 'the value</textarea>', html) # Only our cool editor has this: self.assertIn('Cool Editor Box', html)
def _zope(body): from zope.pagetemplate.pagetemplatefile import PageTemplate template = PageTemplate() template.pt_edit(body, 'text/xhtml') return template
def _chameleon(body, **kwargs): from .zpt.template import PageTemplate return PageTemplate(body, **kwargs)