Re: [Zope-dev] zope.contentprovider not useable together with Zope 2.13.4

2011-03-28 Thread Hanno Schlichting
On Fri, Mar 18, 2011 at 3:34 PM, Michael Howitz m...@gocept.com wrote:
 According to my findings, the provider-expression should work in Zope2 
 PageTemplates (Products.PageTemplates) as it is registered in 
 Products.PageTemplates.Expressions.createZopeEngine.

Sure. The provider expression should work, as Five takes care of
registering it. What doesn't work is the expressiontype directive.
There's only an imperative mode of setting up expression types inside
Zope 2.

 In the project mentioned before Zope3 PageTemplates (zope.pagetemplate and 
 z3c.template) are used, too.
 Sometimes we had permission problems (UnauthorizedBinding: context) with 
 the Zope2 PageTemplates even with Zope 2.11.
 Maybe mixing Zope2 and Zope3 PageTemplates is the source of the permission 
 problems.

That could be. Zope 3 page templates don't have any security context
in Zope 2 as far as I know. So there's neither RestrictedPython nor
AccessControl checks taking place. Once you start mixing them with
Zope 2 page templates for example via macro calls it all gets weird.

 As the outermost template is a z3c.template I doubt fixing the expressiontype 
 declaration will help much in our use case.
 It will help to get zope.contentprovider running in Zope2 as this package has 
 no reference to a TALES-Engine, everything is done in tales:expressiontype.

I'm not sure the existing expressiontype indirection is useful inside
Zope 2. We have lived without it for all those years and until now
nobody complained about it not being there. If we want to have
pluggable namespaces in TAL, we can go directly for
chameleon.zpt.interfaces.IExpressionTranslator instead.

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 )


Re: [Zope-dev] zope.contentprovider not useable together with Zope 2.13.4

2011-03-18 Thread Michael Howitz
Am 15.02.2011 um 15:10 schrieb Hanno Schlichting:
 Hi.

Hi, sorry for the long delay.

 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.

According to my findings, the provider-expression should work in Zope2 
PageTemplates (Products.PageTemplates) as it is registered in 
Products.PageTemplates.Expressions.createZopeEngine.
In the project mentioned before Zope3 PageTemplates (zope.pagetemplate and 
z3c.template) are used, too.
Sometimes we had permission problems (UnauthorizedBinding: context) with the 
Zope2 PageTemplates even with Zope 2.11.
Maybe mixing Zope2 and Zope3 PageTemplates is the source of the permission 
problems.

As the outermost template is a z3c.template I doubt fixing the expressiontype 
declaration will help much in our use case.
It will help to get zope.contentprovider running in Zope2 as this package has 
no reference to a TALES-Engine, everything is done in tales:expressiontype.


Yours sincerely,
-- 
Michael Howitz · m...@gocept.com · software developer
gocept gmbh  co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development

___
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 )


Re: [Zope-dev] zope.contentprovider not useable together with Zope 2.13.4

2011-02-16 Thread Sylvain Viollon
On Tue, 15 Feb 2011 14:46:11 +0100
Michael Howitz m...@gocept.com wrote:

 Hi,
 
  Hello,

 we are upgrading a customers project from Zope 2.11.x to Zope 2.13.4.
 In this project the expression type provider of zope.contenttype is
 used. But loading the configure.zcml of zope.contentprovider fails
 with:
 
 ConfigurationError: ('Unknown directive',
 u'http://namespaces.zope.org/tales', u'expressiontype')
 
 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?
 
 

  I got the same bug in five.grok. I struggled for a while, it is
  weird, because if you include the correct meta ZCML to have
  expressiontype defined, it still doesn't work.

  I fixed my problem with:

  !-- ZCML of this package fails in Zope 2.13 for strange reason --
  exclude package=zope.contentprovider /

  And including Products.Five. contentprovider were working
  like before afterwards.

  If you find a better solution, I would be happy to know it (reading
  Hanno reply makes sense).

  Regards,

  Sylvain,

-- 
Sylvain Viollon -- Infrae
t +31 10 243 7051 -- http://infrae.com
Hoevestraat 10 3033GC Rotterdam -- The Netherlands
___
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 )


Re: [Zope-dev] zope.contentprovider not useable together with Zope 2.13.4

2011-02-15 Thread Hanno Schlichting
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 )