[Zope3-Users] Problem with macro

Marius Gedminas mgedmin at b4net.lt
Mon Feb 26 12:14:45 EST 2007


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.

Marius Gedminas
-- 
Lost packet, 42 bytes, last seen on a saturated OC3, reward $$$.
                -- Eric^2 on Slashdot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20070226/5d577a06/attachment.bin


More information about the Zope3-users mailing list