[Zope] calling macros

Geir Bækholt lists at elvix.com
Tue Apr 20 06:24:38 EDT 2004


Marius,
Tuesday, April 20, 2004, 8:54:36 AM, you wrote:

> I am calling a macro that reference the 'here' variable within python
> scripts. However the I am calling the macro from within a tal:repeat
> block. So the here object within the macro is not the object that I want
> to be working with. Can anyone tell me how I should be doing this so that
> macro is referencing the correct object.

> <metal:block tal:repeat="obj folderContents">
> <dd>
> <div tal:condition="python: obj.portal_type == 'News Item'">
>   <metal:use use-macro="here/newsitem_view/macros/main"/>
> </div>
> </dd>
> </metal:block>

obj

The macro is expanded before tal-statements are evaluated, so whatever
variables defined outside the macro are available.


-- 
__________________________________________________________________

 Geir Bækholt    ·   Interaction Engineer   ·    Plone Solutions

 Development · Training · Support · http://www.plonesolutions.com
__________________________________________________________________




More information about the Zope mailing list