[Zope] Howto Use METAL Macros from PythonScripts?

Johan Carlsson johanc at easypublisher.com
Sun Jan 25 05:44:56 EST 2004


I want to Use it (as in metal:use-macro).
It probably means that I want to call it like a method (but I don't know 
how it's suppost to work yet), and I definitely want to send arguments
to it when calling it.

Why I want this is because I want to construct a generic template
for rendering "menus" that takes one argument "menu_name".

I then want to use this generic template from a PythonScript that
seeks up all existing menus in the current context and renders them.
(Eg. loop over objectValue(spec='MenuClass'))

I don't want to build this in TAL because I regard this as pure logic,
so I would prefer having it in a PythonScript.

Like this:

<div metal:define-macro="render_all_list_in_context">
  <div tal:repeat="listname
       python:here.objectIds(spec='EasyNamedMenu')">
   <div
     metal:use-macro="here/macro_listings.pt/macros/generic_named_list"/>
  </div>
</div>







-- 
Johan Carlsson          Tel: + 46 8 31 24 94
Colliberty              Mob: + 46 70 558 25 24
Torsgatan 72            Email: johanc at easypublisher.com
SE-113 37 STOCKHOLM     Skype: colliberty





More information about the Zope mailing list