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

David Hassalevris bluepaul@earthlink.net
Wed, 5 Feb 2003 11:42:50 -0800


Try changing
>   <dtml-call expr="incrementRowLength(counter)" -->
>            <dtml-var counter>
to
<dtml-call expr="counter= incrementRowLength(counter)">
<dtml-var counter>

Or inside the python script, push the new value of "counter" back into the
REQUEST object:

DavidH
----- Original Message -----
From: "Asad Habib" <ahabib1357@yahoo.com>
To: <zope@zope.org>
Sent: Wednesday, February 05, 2003 9:26 AM
Subject: [Zope] REQUEST variable is not being modified by Zope Python script


> Hello. I am calling a Python script called
> 'incrementCounter' from a DTML Document and passing a
> variable to it called 'counter'. However, for some
> reason the value of this variable remains unchanged
> when control returns to the DTML method. I tested the
> Python script independently via the management
> interface and it works fine. The code for both the
> document and script is listed below. Any help would be
> greatly appreciated. Thanks.
>
>
> <dtml-call "REQUEST.set('rowLength', 6)">
> <dtml-call "REQUEST.set('counter', 0)" >
>
> <dtml-in expr="aq_parent.objectValues(['Local File
> System'])" prefix="fileObject" sort="id"
> skip_unauthorized>
>
>     <dtml-if "AUTHENTICATED_USER.has_role(['Local',
> 'Manager'], this())">
>           <a href ="/Personal/<dtml-var
> "getId()">">#<dtml-var "getId()"></a>
>           <dtml-call
> expr="incrementRowLength(counter)" -->
>            <dtml-var counter>
>     </dtml-if>
> </dtml-in>
>
>
> increment = 1
> counter = int(counter) + int(increment)
> return counter