On 21 August 2010 06:34, Mikko Ohtamaa <[email protected]> wrote: > > Hi, > > I am trying to use plone.app.registry to create configuration fields which > are WYSIWYG editable. > > I have schema: > > contact_form_suffix = schema.Text(title=_(u"Contact form bottom text"), > description=_(u"Custom text for the > long contact form bottom part"), > required=False, > default=u"") > > Then I declare the widget: > > class ControlPanelForm(RegistryEditForm): > """ Zoho settings form in Site Setup """ > > label = _(u"Zoho integration settings") > > description = _(u"These settings are used to connect your Plone site to > various Zoho services") > > schema = ISettings > > def updateFields(self): > RegistryEditForm.updateFields(self) > self.fields['crm_lead_extra_data'].widgetFactory = > TextLinesFieldWidget > self.fields['contact_form_prefix'].widgetFactory = > WysiwygFieldWidget > > ...and for this I get: > > Module zope.tales.tales, line 696, in evaluate > - URL: > file:/Users/moo/twinapex/twinapex/eggs/Products.TinyMCE-1.1.2-py2.4.egg/Products/TinyMCE/skins/tinymce/wysiwyg_support.pt > - Line 5, Column 2 > - Expression: <PathExpr > standard:u'context/@@plone_portal_state/anonymous'> > - Names: > {'args': (), > 'context': <RecordsProxy for > mfabrik.plonezohointegration.interfaces.ISettings>, > 'default': , > 'loop': {}, > 'nothing': None, > 'options': {}, > 'repeat': {}, > 'request': <HTTPRequest, > URL=http://localhost:8080/mfabrik/@@zoho-controlpanel>, > 'template': > <zope.app.pagetemplate.viewpagetemplatefile.ViewPageTemplateFile object at > 0x107614050>, > 'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object at > 0x1105b7e50>, > 'view': <WysiwygWidget 'form.widgets.contact_form_prefix'>, > 'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper > object at 0x1105b7a50>} > Module zope.tales.expressions, line 217, in __call__ > Module Products.PageTemplates.Expressions, line 163, in _eval > Module Products.PageTemplates.Expressions, line 125, in render > Module plone.memoize.view, line 74, in memogetter > Module plone.app.layout.globals.portal, line 102, in anonymous > AttributeError: __of__ > > It appears that WysiwygWidget relies on acquisition. plone.app.registry > ControlPanelForm.getContents() returns RecordsProxy objects which lack the > acquisition chain. > > So... which one is correct, which one is wrong, should I file a bug and is > there a workaround availble? > > This all on Plone 3.3.5.
The WYSIWYG widget is wrong. It should not rely on acquisition in this way. There are workarounds, though. You don't strictly need to use the RecordsProxy, for instance. You can "edit" the Plone site root and provide an adapter to your settings interface ala plone.app.controlpanel (which uses formlib, but the same pattern works), for example. Martin _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
