beno - wrote at 2006-7-28 15:43 -0700:
> ...
>  <tr tal:repeat="item batch">
>    <td tal:define="number repeat/item/number"
>            tal:content="number">1</td>
>    <td tal:content="item/title">title</td>
>    <td><tal:content 
> metal:use-macro="here/?number/macros/author">author</tal:content></td>
> ...
> Traceback
> ...
> Line 22, Column 4
> Expression: standard:'here/?number/macros/author'
> ...
>KeyError: 'number' (Also, an error occurred while attempting to render the 
>standard error message.)

The traceback tells you (kept part) that the "KeyError: 'number'" comes
from "here/?number/macros/author" and it is right:

   Unless you use "global", variables defined in TAL only live
   within the element (aka "tag") you have defined them in.

   In your special case, this is the "td" element.
   It it not defined in the following "td"s.

A common approach is to use artificial "block" elements to
carry the definitions for some elements in the loop body -- similar to

      <tr tal:repeat="...">
        <tal:block define="number ...">
          <td tal:content="number" />
          <td><tal:content metal:use-macro="here/?number/..." /></td>

Apparently, you already use "tal" prefixed tag names.
The "tal:block" is another standard use...

Another advice: carefully read the PageTemplate section in
the Zope Book (2.7 edition, on "").

Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to