[Zope3-Users] Problem with macro

Florian Lindner mailinglists at xgm.de
Mon Feb 26 08:40:13 EST 2007


Am Sonntag, 25. Februar 2007 15:03 schrieb Marius Gedminas:
> On Sun, Feb 25, 2007 at 02:02:43PM +0100, Florian Lindner wrote:
> > I have a simple problem. A template:
> >
> > <html metal:use-macro="views/standard_macros/view"
> > i18n:domain="xgm.de/Blog"> <body>
> >     <metal:block metal:define-macro="Blog">
> >     <metal:block metal:fill-slot="body">
> >       <h1 tal:content="context/title" />
> >       <div tal:replace="context/description" />
> >          [...]
> >       </div>
> >
> >     </metal:block>
> >     </metal:block>
> >   </body>
> > </html>
> >
> > That is registered as view.html.
>
> How?  <browser:page name="view.html" template="foo.pt" /> ?
>
> > Now I want to use the macro in another page:
> >
> > div metal:use-macro="context/Blog/@@view.html/Blog" />
> >
> > (tried different variations)
>
> Ah, but did you try
>
>       metal:use-macro="context/Blog/@@view.html/index/macros/Blog" />

No, have not tried it yet.

But            
<div metal:use-macro="context/Blog/@@view.html/index/macros/Blog" />

gives an error too:

  File "/home/florian/Zope3/src/zope/tales/expressions.py", line 124, in _eval
    ob = self._traverser(ob, element, econtext)
  File "/home/florian/Zope3/src/zope/app/pagetemplate/engine.py", line 65, in 
__call__
    object = object[name]
KeyError: 'Blog'

Blog in a object contained by the xgm object. Blog is object that has the 
view.html registered.

Thanks,

Florian


More information about the Zope3-users mailing list