Answer below

Infor Gates wrote:
Hello Zopist

I am new and try to learn python script with ZSQL in
Zope. I have read the Zope Book. However, most of them
are in DTML and very few on python script. I have a
little knowledge on Zope and SQL but am lost in trying
to see the whole picture of zope/pythonscript/zsql.

I have a simple database record of person details.

I used a simple insertZSQL statement:
INSERT INTO person
(
p_givenname, p_familyname, p_datebirth, p_sex )
VALUES (
<dtml-sqlvar p_givenname type="string">
<dtml-sqlvar p_familyname type="string">
<dtml-sqlvar p_datebirth type="string">
<dtml-sqlvar p_sex type="string">
);


In DTML script:
<dtml-call "REQUEST.set('p_givenname','Ian')">
<dtml-call "REQUEST.set('p_familyname','Gates')">
<dtml-call "REQUEST.set('p_datebirth','22-10-56')">
<dtml-call "REQUEST.set('p_sex','Male')">
<dtml-call insertZSQL>

How can I do something similar in python script?

context.REQUEST.set('p_givenname','Ian') ...

But note that if the input data is originating in a form then it is already in the REQUEST and you do not need to use set.

Cliff

Can anyone point me to an example? Very much
appreciated.

Thank you.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db

Reply via email to