[Zope] How does DTML handle return variables from Python

McDonnell, Larry lmcdonnell@protonenergy.com
Wed, 19 Jun 2002 09:06:47 -0400


Thank you, thank you, thank you...

This works, I can stop banging my head against the wall now :^).


-----Original Message-----
From: David Burton [mailto:eloquence@eloquent-designs.f2s.com]
Sent: Wednesday, June 19, 2002 8:29 AM
To: McDonnell, Larry
Subject: Re: RE: [Zope] How does DTML handle return variables from
Python


Nothing in the code that you've sent would directly change part_num.

Therefore I'm assuming that part_num is supposed to be set by
concat_sub_types_to_part_num(st,sub_type2).

In that script are you setting part_num to the concatenated value, or using
something like request.set('part_num',st+sub_type2)?

If you're just assigning part_num, then that will be a variable local to the
script, and will not affect the part_num variable in the calling page.

If you've used request.set... and you're still having problems, try
replacing the <dtml-var part_num> with <dtml-var "REQUEST.get('part_num')">

HTH,
David Burton

19/06/2002 12:51:23, "McDonnell, Larry" <lmcdonnell@protonenergy.com> wrote:

>Hi,
>
>In my first dtml doc I have seven select statements to help the user
>generate a part number. So I stop getting the global undefined error
>message, I added the input statement for the part_num variable. I set the
>variable to "zz" so I can see it as a <dtml-var part_num> output on the
next
>dtml doc gen_part_num. The goal is to take the seven select variables to
>create the part_num variable. 
>
><form method="post" action="gen_part_num">
>
><body bgcolor="#FFFFFF" text="#000000">
><select name="st1" size="1">
>    <option value="01-">01</option>
>    <option value="02-">02</option>
>    <option value="03-">03</option>
>.
>.
>  <select name="sub_type2" size="1">
>    <option value="01">01</option>
>    <option value="02">02</option>
>.
>.
><input name="part_num" type = "hidden" size="2" value="zz">
>
>On the next form it will be a basic re-display of the part number and a
>submit to add part_num to the db. 
>
><form name="form1" method="post" action="create_part_num">
><p>Your here!!<dtml-var st1><dtml-var sub_type2><dtml-var part_num> pn</p>
>
><dtml-if expr="part_num=='zz'">
><dtml-call "REQUEST.set('part_num',' ')"> 
><p><dtml-var part_num>part_num
></dtml-if>
>
><dtml-var expr="concat_sub_types_to_part_num(st1,sub_type2)">
>
>**<dtml-var part_num>pn
><input type="submit" name="Submit" value="Submit">
>
>I can see the dtml-vars but when I call the python script part_num is still
>set to blank. Sorry for the long email. Thanks in advance.
>
>-----Original Message-----
>From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
>Thomas B. Passin
>Sent: Tuesday, June 18, 2002 3:46 PM
>To: ''Zope@Zope. Org' (E-mail)'
>Subject: Re: [Zope] How does DTML handle return variables from Python
>
>
>[McDonnell, Larry]
>>
>> Yes, the Parameter List is set to st1,sub_type2.
>>
>
>Good.  Python will return the concatenated parameters, so it must not be
>getting them.  I can't tell where they come from, but you must not be doing
>something that you think you are doing.
>
>BTW, if you are just concatenating them you won't even need a script:
>
><dtml-var "REQUEST.st1"><dtml-var "REQUEST.sub_type2">
>
>or
>
><dtml-var st1><dtml-var sub_type2>
>
>or
>
><dtml-var "st1 + sub_type2">
>
>or
>
>&dtml-st1;&dtml-sub_type2;
>
>That's all you need (I'm assuming that these variables come from a
>previously-submitted form, so that they are contained in the REQUEST).
>
>Of course, if you aren't getting these parameters correctly, these simpler
>forms won't work either.
>
>Maybe you better explain in simple terms just how these two items are
>getting to your page.
>
>Cheers,
>
>Tom P
>>
>> -----Original Message-----
>> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
>> Thomas B. Passin
>> Sent: Tuesday, June 18, 2002 3:02 PM
>> To: 'Zope@Zope. Org' (E-mail)
>> Subject: Re: [Zope] How does DTML handle return variables from Python
>>
>>
>> [McDonnell, Larry]
>> >
>> > I sorted of asked this question before but I am still hitting a wall. I
>am
>> > using this python code:
>> >
>> > context, container, script, traverse_subpath
>> > part_num = st1 + sub_type2
>> > return part_num
>> >
>> > But when "part_num" is returned it is blank. I test the script and
>> > "part_num" has a return value.
>> >
>>
>> You have to include the two parameters in the script's parameter list,
>which
>> you will find in the Edit tab for the script.  Otherwise they don't get
>> passed to the script.
>>
>
>
>
>
>_______________________________________________
>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 )
>
>
>_______________________________________________
>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 )
>
"Into the abyss we stare, hoping that the abyss does not gaze so intently
upon us"