Hi. On Tue, Feb 15, 2011 at 2:46 PM, Michael Howitz <m...@gocept.com> wrote: > I tracked this down to Zope2/App/exclude.zcml where the meta.zcml of the > package zope.browserpage gets excluded. > Sadly this ZCML file defines the expressiontype directive. > > What is the current way to use zope.contentprovider in a Zope2 environment?
Hhm, I wasn't aware that this was possible at all so far. I thought we only made zope.viewlet available in Zope2 via Products.Five.viewlet. > I had the following idea to fix this issue: > > * move the registration of the directive from meta.zcml into > meta-expressiontype.zcml > * include meta-expressiontype.zcml of zope.browserpage > * include meta-expressiontype.zcml in our project to get around the exclusion > of Zope2 > > Are there any better ideas? I think you need a five.contentprovider package for this to work correctly. The expressiontype function in zope.browerpage.metaconfigure uses zope.pagetemplate.engine.Engine.registerType. zope.pagetemplate.engine.Engine is a module global, but the wrong one in a Zope 2 context. To get the correct TAL engine in Zope 2, you need to call Products.PageTemplates.Expressions.getEngine, which returns a module global from that module. Otherwise you get a wrong context. The trusted version is accessible via Products.Five.browser.pagetemplatefile.getEngine. You can then call registerType on both of these engines. Also note that you need to use Products.Five.pagetemplatefile.ViewPageTemplateFile to register templates. The ZCML directives available in Zope 2 use that one. The zope.pagetemplate based classes don't work correctly inside Zope 2. Hanno _______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org https://mail.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - https://mail.zope.org/mailman/listinfo/zope-announce https://mail.zope.org/mailman/listinfo/zope )