[z3-five] Z2/Z3 skin integration, or, views and portal_skins.

Tarek Ziadé tziade at nuxeo.com
Tue Nov 9 23:04:00 MET 2004


Lennart Regebro wrote:

> Lennart Regebro wrote:
>
>> I tried to overcome that by making Five use Zope2 PageTemplateFiles 
>> instead of Zope3 PageTemplateFiles. 
>
>
> Today ZBuddah smiled upon me and handed me a small bit of Zen, and I 
> came a little bit longer. I was able to make a subclass of Zope2 
> PageTemplateFile that overrides pt_getContext and manipulates the 
> context into what it should be instead of what Zope2 gives it.
>
> This is a parallell to what ViewPageTemplateFile does in Zope3.
>
>
> However, ViewPageTemplateFile does one more thing than manipulates the 
> context. It also subclasses TrustedAppPT. This makes 
> ViewPageTemplateFile *trusted code*. Hohoho, very clever, indeed they 
> are file based, and as such trusted. Problem: Zope2 PageTemplateFiles 
> are *not* trusted. This means that with my clever hack 
> tal:content="view/anything" will fail with "You are not allowed to 
> access 'anything' in this context". I tried 
> security.declarePublic('anything') but it didn't help!
>
> So close and yet no banana. Any ideas? Is this for some other reason 
> not a feasible idea anyway? If I solve this, will I just run into more 
> troubles?
>
I ran in the same problem and came up with a working solution to mix 
zope 2 and Zope 3 page templates:

(well actually, what i was trying to do it on the other way : Render 
Zope 3 page template within a zope 2 / CMF page template, but I had the 
same issue)

About this security issue, Zope 3 comes with a method "queryView" in 
component module wich renders a zope 3 page template given the object 
instance and the view name, going thru the right View object found in 
the zcml

So I have just created a small Zope 2 CMF Product  that renders zope 3 
views through a method.
This method is then callable from a Zope 2 page template.

That makes my Five product views work in a CMF context at this time,
since all of them are called through one generic zope 2 page template.

I don't know if it's the right way to do it (zope 2 into zope 3 might be 
better maybe) since
 I have to deal now with ugly urls and figure out how to make them look 
better...
 but my goal is to make five products work within a cms based on cmf, so...

Tarek

>
> //Lennart
>
>
> _______________________________________________
> z3-five mailing list
> z3-five at codespeak.net
> http://codespeak.net/mailman/listinfo/z3-five



-- 
Tarek ZIADE, R&D Engineer
Nuxeo SARL: Zope Service Provider.
Mail: tz at nuxeo.com - Tel: +33 (0)6 30 37 02 63
Nuxeo Collaborative Portal Server: http://www.nuxeo.com/cps
Gestion de contenu web / portail collaboratif / groupware / open source



More information about the z3-five mailing list