[Zope] renaming python input params in DTML

Randall F. Kern randy@spoke.net
Sun, 14 Jan 2001 14:01:42 -0800


You can't use DTML tags inside an expr="" attribute; the value of expr
is python code.

To access the sequence-item variable from python, you need:
	_['sequence-item']

So, try something like this (untested):

<dtml-in expr="REQUEST.form.items()">
<dtml-in expr="testSQL(text=_['sequence-key'] + 'x' +
_['sequence-item'])">
<dtml-var result>
</dtml-in></dtml-in>


-Randy

-----Original Message-----
From: Lee [mailto:lee.reilly@ntlworld.com]
Sent: Sunday, January 14, 2001 1:23 PM
To: zope@zope.org
Subject: [Zope] renaming python input params in DTML


Hi,

I am having a problem passing in a variable to a Python method, which is
obtained from the REQUEST object - I'd really appreciate someone's
insight into how to correctly go about this.

I have a form that submits a parameter named '9728430xp0xclasstest' with
a value = 7 to a DTML method.

I have a Python method expecting 'text' as a parameter so I want the
DTML method to send 'text' onto this with a value = the value of the
original parameter appended to name (i.e. 9728430xp0xclasstestx7).

So text=9728430xp0xclasstestx7

Does that make sense?

The Python method, testSQL, returns 'result'. As I recently found out, I
have to make to make use of the REQUEST object to obtain these
parameters.

The following snippet produces the correct value
(9728430xp0xclasstestx7)...

<dtml-in expr="REQUEST.form.items()"><dtml-var sequence-key>x<dtml-var
sequence-item></dtml-in>

... but how can I can pass this as 'text' to my Python method?

Am I on the right track with the following:

<dtml-in expr="REQUEST.form.items()">
<dtml-in expr="testSQL(text='<dtml-var sequence-key>x<dtml-var
sequence-item>')">
<dtml-var result>
</dtml-in></dtml-in>

Thank very much for any help you can offer.

- Best regards,

PS:

<dtml-let text="'9728430xp0xclasstestx7'">
<dtml-var text>
</dtml-let> ... may help

but...

<dtml-var standard_html_header>
<dtml-in expr="REQUEST.form.items()">
   <dtml-let text="'<dtml-var sequence-key>x<dtml-var sequence-item>'">
  <dtml-var text>
 </dtml-let>
</dtml-in> ... gives me text = x !

Any help would really be appreciated?

Thanks :)

--
Lee Reilly
mailto:lee.reilly@ntlworld.com

ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,,ø¤º°`°º¤ø,,,,

HAVE SKILLS; WILL TRAVEL.

I'm currently looking for an internship in the USA
in the field of web development. Ideally, I'm looking
for a placement for 3 to 18 months. Can you help?

More details, my resume, etc. @
http://homepages.strath.ac.uk/~aeu97172/

</shameless plug>




_______________________________________________
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 )