[ZPT] NEVERMIND Re: problems with RepeatVariable

Lynn Walton waltonl@franklin.edu
Thu, 25 Oct 2001 13:48:11 -0500


Nevermind ... I just looked at Iterator.py and learned that while index is
just an attribute, the other things like, number, end, etc are methods and
therefore need to have () after them in my python: expression.

Sorry to bug the list.
Lynn

Lynn Walton wrote:

> I have the following:
>
> <span tal:define="mainMenuTree python:here.mainTemplates.buildSiteMap()"
>
>       tal:omit-tag="">
>
>  <span tal:repeat="menuItem mainMenuTree" tal:omit-tag="">
>      <a href="" tal:attributes="href menuItem/name">
>     <span   tal:replace="menuItem/name"></span></a>&nbsp;
>     <span    tal:replace="python: repeat['menuItem'].number">1</span>
>     <span tal:condition="python: not
> repeat['menuItem'].end">|&nbsp;</span>
>   </span>
>
> </span>
>
> When I use python: repeat['menuItem'].number" I get
> <method Iterator.number of Iterator instance at ecf6d4>  printed out
> instead of the number.
>
> When I use python: repeat['menuItem'].index" I get the proper index.
>
> When I use repeat/menuItem/number  rather than a python: expression, it
> works giving the numbers.
> But I thought
> "python: repeat['menuItem'].number" was supposed to be an allowable
> syntax?
>
> Likewise,
> <span tal:condition="python: not repeat['menuItem'].end">
> gives isn't working, because it seems to be returning <method
> Iterator.end of Iterator instance at e937cc>  instead of true or false.
>
> Can someone advise me on what I'm missing. I'm trying to follow the doc
> at
> http://www.zope.org//Wikis/DevSite/Projects/ZPT/RepeatVariable
>
> I'm using PageTemplates-1-4-1
> TAL 1.4.1
> ZTUtils 1.1.2
>
> Thanks,
> Lynn