Alexis Rhoda's suggestion sounds similar. I edited the code as follows, both with and without the 'global' parameter with the same error thrown. I read the material you recommended before writing the list and have been referencing it. I confess that snakes would bite me repeatedly though before my eyes for lack of seeing them, no matter how hard I try. Your further help would be very much appreciated. TIA,
beno

  <tr tal:repeat="item batch">
   <tal:block define="global number repeat/item/number">
    <td 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>
    <td><tal:content metal:use-macro="here/?number/macros/content">content</tal:content></td>
    <td tal:content="item/bobobase_modification_time">
      modification date</td> 
   </tal:block>
  </tr>

3
TypeError
Sorry, a site error occurred.
Traceback (innermost last):
  • Module ZPublisher.Publish, line 175, in publish_module_standard
  • Module ZPublisher.Publish, line 132, in publish
  • Module Zope.App.startup, line 204, in zpublisher_exception_hook
  • Module ZPublisher.Publish, line 101, in publish
  • Module ZPublisher.mapply, line 88, in mapply
  • Module ZPublisher.Publish, line 39, in call_object
  • Module Shared.DC.Scripts.Bindings, line 306, in __call__
  • Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec
  • Module Products.PageTemplates.ZopePageTemplate, line 222, in _exec
  • Module Products.PageTemplates.PageTemplate, line 96, in pt_render
    <ZopePageTemplate at /rejoice.2012.vi/en-us/Books/getQuote used for /rejoice.2012.vi/en-us/Books/test>
  • Module TAL.TALInterpreter, line 190, in __call__
  • Module TAL.TALInterpreter, line 234, in interpret
  • Module TAL.TALInterpreter, line 613, in do_loop_tal
  • Module TAL.TALInterpreter, line 234, in interpret
  • Module TAL.TALInterpreter, line 409, in do_optTag_tal
  • Module TAL.TALInterpreter, line 394, in do_optTag
  • Module TAL.TALInterpreter, line 389, in no_tag
  • Module TAL.TALInterpreter, line 234, in interpret
  • Module TAL.TALInterpreter, line 657, in do_useMacro
  • Module Products.PageTemplates.TALES, line 221, in evaluate
    URL: /rejoice.2012.vi/en-us/Books/getQuote
    Line 22, Column 8
    _expression_: standard:'here/?number/macros/author'
    Names:
    {'container': <Folder instance at e909350>,
    'context': <Folder instance at 92e1ad0>,
    'default': <Products.PageTemplates.TALES.Default instance at 0x8a1d62c>,
    'here': <Folder instance at 92e1ad0>,
    'loop': <SafeMapping instance at 8ff2380>,
    'modules': <Products.PageTemplates.ZRPythonExpr._SecureModuleImporter instance at 0x8a1d06c>,
    'nothing': None,
    'options': {'args': ()},
    'repeat': <SafeMapping instance at 8ff2380>,
    'request': <HTTPRequest, URL=""> 'root': <Application instance at 90c1f80>,
    'template': <ZopePageTemplate at /rejoice.2012.vi/en-us/Books/getQuote used for /rejoice.2012.vi/en-us/Books/test>,
    'traverse_subpath': [],
    'user': Anonymous User}

  • Module Products.PageTemplates.Expressions, line 174, in __call__
  • Module Products.PageTemplates.Expressions, line 162, in _eval
  • Module Products.PageTemplates.Expressions, line 107, in _eval
TypeError: iteration over non-sequence (Also, an error occurred while attempting to render the standard error message.)


Dieter Maurer <[EMAIL PROTECTED]> wrote:
beno - wrote at 2006-7-28 15:43 -0700:
> ...
>
>
> tal:content="number">1
> title
> author
> ...
> 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




...

...



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 "plope.org").



--
Dieter


Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.
_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to