This is the answer from Tres when I had the same problem: """ AFAIK, global names are defined in the scope of the template which includes the macro; the "source" template for the macro is not itself "evaluated" before inclusion (METAL processing is done *before* TAL processing). """ --On Sonntag, 27. Oktober 2002 13:23 -0700 Mark Gibson <mark@dimensional.com> wrote:
I define a variable in a tag, and try and use it in a contained tag, and get a NameError on that variable. Can anyone help me understand why? The snippet of code is below:
<html metal:use-macro="here/GetTemplate" tal:define="objs here/regionObjects; num_objs python:objs[0] ">
<div metal:fill-slot="body"> <table border="0" width="100%" tal:condition="python:num_objs > 11"
...
Error Type: NameError Error Value: global name 'num_objs' is not defined
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
--------------------------------------------------------------------- - Andreas Jung http://www.andreas-jung.com - - EMail: andreas at andreas-jung.com - - "Life is too short to (re)write parsers" - ---------------------------------------------------------------------