[Zope] TAL: Replacing an attribute in a macro call

Mark Roach mrroach at okmaybe.com
Thu Jun 3 05:00:09 EDT 2004


I have a macro defined for a "select" item that I now would like to put
twice in my page. This means I need to have to different names for the
items, but I can't seem to figure out how to change an attribute while
calling a macro. My macro definition looks like this:

<select metal:define-macro="user" name="user" tal:define="items python:container.function()">
  <div tal:repeat="option items" tal:omit-tag="">
      <option tal:content="option/data">Call Type</option>
  </div>
</select>

What I had hoped I could do is use the macro like this:

<select metal:use-macro="container/selects/macros/user" name="somethingelse">
 ...
</select>

but this doesn't work as the macro overwrites that attribute with its
own (which makes sense). I have tried leaving the name undefined in the
macro, but it then renders without a name.

What is the "correct", or at least idiomatic way to do this?

Thanks,

Mark Roach




More information about the Zope mailing list