[Zope] REQUEST variable is not being modified by Zope Python script

Dylan Reinhardt Dylan@DylanReinhardt.com
Wed, 05 Feb 2003 10:00:11 -0800


You're only changing the value of counter in the scope of the Python 
script.  Your script is returning the new value, but you aren't doing 
anything with that value.  That's why it appears not to be working.

But once you get that right, you'll turn up other hassles.  :-)  I'd advise 
against using a Python script for this.

If all you're doing is counting iterations over a loop, it may be far 
easier to do this:

<dtml-call "REQUEST.set('my_ids', [])">
...
<dtml-if "some_test">
    <dtml-call "my_ids.append(getId())">
    <a href ="/my_folder/<dtml-var "my_ids[:-1]">>
       # <dtml-var "my_ids[:-1]">
    </a>
</dtml-if>
...
<dtml-var "len(my_ids)"> item(s) were found.

Etc., etc.

HTH,

Dylan