[Zope] passing the parameters to zsql method

Dario Lopez-Kästen dario at ita.chalmers.se
Thu Oct 27 04:23:52 EDT 2005


Denis V. Gudtsov wrote:

>DLK> use an intermediary Script (Python), ie:
>[..skipped..]
>
>Thank you. But, can i do this without using python? From zpt -> to
>zsql?
>
>  
>
[cc-ing: zope at zope.org]

well, yes in a way.

ZSQL methods have to be called like other metods, but AFAIK, they cannot 
be traversed like, for instance, scripts. As I understand it, this is  
for security reasons (I myself would never allow a zsql to be exposed 
without some scripts in between, but that's just me...)

Anyway, one way to do what you want is to do more in the zpt than may be 
advisable: exactly how to do it, I leave up to you, becasue there are 
several different ways of achieving this, but I give general directions. 
Also, there are probably other ways than what I describe below.

You can make the form post to iself, and use calls inside the form to 
prepare the input to the zsql.

lets say your zpt is called "entry_form" and looks something like this 
(pseudo zpt):

<span tal:define="name request/form/name;
                  account request/form/account;
                  unused python: clients_add_sql(name=name, account=account);" 
      tal:omit-tag="" />

<form action="entry_form">
<input type="text" name="name">
<input type="text" name="account">
<input type="submit">
</form>

Not sure if this works, but that is the general idea. This was inspired from

http://www.plope.com/Books/2_7Edition/AdvZPT.stx#2-9

section: "Form Processing"

Good luck!

/dario


-- 
-- -------------------------------------------------------------------
Dario Lopez-Kästen, IT Systems & Services Chalmers University of Tech.
Lyrics applied to programming & application design:
"emancipate yourself from mental slavery" - redemption song, b. marley




More information about the Zope mailing list