[Zope] METAL question

Andreas Tille tillea at rki.de
Thu Sep 25 05:43:32 EDT 2003


Hi,

I try to use Formulator a little bit more effective to enhance the my code with metal.
Currently I do the following:


  <th>
   <span tal:replace="structure python:form.item_a.get_value('title')">item_a</span>
  </th>
  <td tal:define="item_a request/item_a|nothing">
     <input tal:replace="structure python:form.item_a.render(item_a)">
  </td>

  <th>
   <span tal:replace="structure python:form.item_b.get_value('title')">item_b</span>
  </th>
  <td tal:define="item_b request/item_b|nothing">
     <input tal:replace="structure python:form.item_b.render(item_b)">
  </td>

  ...

I would like to find a clever METAL macro which enables me to use

  <div metal:use-macro="here/form_zpt/macros/item_macro/item_a">Item A</div>
  <div metal:use-macro="here/form_zpt/macros/item_macro/item_b">Item B</div>
  ...

Unfortunately I have no idea this is possible at all because I have to handle
different objects with just the same naming convention:
     form.item_a
     item_a (Variable to define)
     request/item_a

Any hint whether my intent makes sense or if this is a stupid idea?

Kind regards

         Andreas.



More information about the Zope mailing list