RE: [Zope] How to concatenate variables
Ok, how do you use <dtml-in concat_sub_type_to_part_num(st1,sub_type2)>? I keep getting a key error. Can you use a python script passing variables in a dtml-in statement? -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Friday, June 14, 2002 3:05 PM To: McDonnell, Larry Cc: 'Zope@Zope. Org' (E-mail) Subject: Re: [Zope] How to concatenate variables McDonnell, Larry writes:
I am having problems concatenating variables. I have seven pull down menus. Selecting one from each menu will create a part number. I setup a test to see if this would work. I have one dtml doc with the menus. After a submit it calls this dtml doc:
<form name="form1" method="post" action=""> <dtml-let pn="' ' "> <dtml-call concat_sub_type_to_part_num(st1,sub_type2)> <dtml-var st1>st1<dtml-var sub_type2>st2 <dtml-var expr="pn==st1+sub_type2"> <dtml-var pn> pn </dtml-let> </form>
I call a python script concat_sub_type_to_part_num and pass two of the menu selections in this test. I tried to concat there but no luck. I can only see the variables I passed. Functions are unable to change strings in the callers context.
You need to return the concatenated value. And you must not use "dtml-call" in this case, as it discards the return value. Dieter
McDonnell, Larry writes:
Ok, how do you use <dtml-in concat_sub_type_to_part_num(st1,sub_type2)>? I keep getting a key error. Can you use a python script passing variables in a dtml-in statement? Maybe, some background reading would help you:
Zope Book or <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html> Your problem above it that the first attribute to most DTML tags is treated as a shorthand for a "name" object attribute. This means, the value is interpreted as a name for a variable/object and not as an expression. Use <dtml-in expr="concat_sub_type_to_part_num(st1,sub_type2)"> Dieter
participants (2)
-
Dieter Maurer -
McDonnell, Larry