[Zope3-dev] ZPT TTW Metal use-macro evaluation....
Jim Fulton
jim at zope.com
Mon Nov 8 14:32:32 EST 2004
Craig Ewington wrote:
...
> I have a question regarding Zope Page Templates:
>
> From the browser (i.e. TTW) I created a ZPT page and entered the
> following source definition:
>
> <html metal:use-macro="views/standard_macros/page">
> <div metal:fill-slot="body">
> Test Content
> </div>
> </html>
>
>
> With 'expand macros' checked I get a warning that the macro expansion
> fails as follows...
>
> <!-- Page Template Diagnostics
> Macro expansion failed
> exceptions.KeyError: 'views'
> -->
>
> After poking around the Zope3-dev list for a bit, I changed the source
> definition to:
>
>
> <html metal:use-macro="context/standard_macros/page">
> <div metal:fill-slot="body">
> Test Content
> </div>
> </html>
>
> I get a similar error message:
>
> <!-- Page Template Diagnostics
> Macro expansion failed
> exceptions.KeyError: 'context'
> -->
>
>
> I had presumed that I was able to enter METAL statements into a TTW ZPT
> page - perhaps this is not correct? Does anyone understand how to make
> this work? I'm using the final release version of Zope3, checked out
> from svn this morning.
As you found out, "views" is deprecated.
I was going to say:
As Stephan almost pointed out, 'context' is only available for views.
It can be used in either file-system-based views or TTW views. If you are
creating ZPT Pages in content folders, context is unavailable.
But that isn't true. "context" is stil available. It is a alias for
"container". I would have said that it would be depricated, but I'm
not sure it should be. For example, the Rotterdam skin depends on it.
Anyway, you should be able to use:
<html metal:use-macro="container/@@standard_macros/page">
or
<html metal:use-macro="context/@@standard_macros/page">
But that doesn't work either due to a bug in the Rotterdam skin.
The main template for the Rotterdam skin only works with trusted
ZPT code. This could and should be fixed. :(
The ZopeTop skin has the same problem. Dang. I guess we need to
test the skins with TTW templates. Anybody wanna work on this?
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Zope3-dev
mailing list