[Zope3-Users] Problem with macro

Florian Lindner mailinglists at xgm.de
Mon Feb 26 14:10:40 EST 2007


Am Montag, 26. Februar 2007 18:14 schrieb Marius Gedminas:
> On Mon, Feb 26, 2007 at 02:40:13PM +0100, Florian Lindner wrote:
> > 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">
>
> ...
>
> > > > That is registered as view.html.
> > > >
> > > > 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.
>
> Do you know which 'Blog' is the one that gives you the error?  The macro
> or the item on 'context'?
>
> It could very well be that your define-macro doesn't take effect, because
> it is inside a use-macro and outside any fill-slot.

It's probably that. I've changed the Blog macro to BlogMacro und now it 
complains abobut BlogMacro being missing.
How would you do that? (for explanation what I want see my original posting)

Thanks,

Florian


More information about the Zope3-users mailing list