Re: zope.contentprovider not useable together with Zope 2.13.4

Hanno Schlichting <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi.

On Tue, Feb 15, 2011 at 2:46 PM, Michael Howitz <[email protected]> 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  -  [email protected]
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 )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.