[z3-five] Re: Using Zope2 page templates with Five

Lennart Regebro regebro at nuxeo.com
Fri Jan 28 13:27:15 MET 2005


Fred Drake wrote:
> On Thu, 27 Jan 2005 23:16:58 +0100, Lennart Regebro <regebro at nuxeo.com> wrote:
>>The METAL implementation isn't compatible, so you can't call macros
>>across versions.
> 
> What doesn't work about it, though?  Can you provide a traceback?

*Puts thinking cap on*
Ehmm... I don't remember.
*Takes thinking cap off again*

I did dig into this in like November/Decemeber, and I have a clear 
memory of there being some incompatibility between the way a macro is 
stored in Z2 and Z3 page templates. That however, may very well just 
have been the end stop of one of my attempts of fixing the problem.

But the traceback you get at the start is this:

     *  Module Products.PageTemplates.ZRPythonExpr, line 45, in __call__
       __traceback_info__: atool.listFilteredActionsFor( here )
     * Module Products.PageTemplates.PythonExpr, line 50, in 
_bind_used_names

AttributeError: 'TrustedZopeContext' object has no attribute 
'getCompiler' (Also, an error occurred while attempting to render the 
standard error message.)

This is with a clean default CMF site, and FiveTests SimpleContent, with 
one of the PT's modified to have:
<html metal:use-macro="context/main_template/macros/master">

(Obviously this is using a "FivePageTemplateFile" that adds "here" to 
the context, or it would fail on that). Like so:

class FivePageTemplateFile(ViewPageTemplateFile):

     def pt_getContext(self, instance, request, **_kw):
         # instance is a View component
         namespace = super(FivePageTemplateFile,
             self).pt_getContext(instance, request, **_kw)
         namespace['here'] = namespace['context']
         return namespace

The problem is similar in the other direction: You get access denied 
when you try to access anything on the Zope3 page template from a Zope2 
page template. That may be fixed by using the TrustedPageTemplateFile 
that Dieter made, I haven't tried that. But that is a less important 
problem anyway.


> Only for tests that involve macros.  Are there any behaviors that show
> differences outside the set of names and the macro problem?

Not that I'm aware of, but then the problem is not differences, but 
integration, that is, the possibility to call Z2 macros from a Z3 
template (and the other way around).

-- 
Lennart Regebro, Nuxeo     http://www.nuxeo.com/
CPS Content Management     http://www.cps-project.org/



More information about the z3-five mailing list