Mailing List Archive

How do I use my archetypes-generated form to insert data into a mysql table?
I made a form using ArchGenXML and want to use it to populate a table
in a mysql database. So far I have not come across a good tutorial on
how to do this. Someone suggested I use ZSQL methods. I understand how
to create them, but how exactly would I call a ZSQL method with the
information from my form?

Thanks,

Anna
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db
Re: How do I use my archetypes-generated form to insert data into a mysql table? [ In reply to ]
Am 16.10.2006, 14:13 Uhr, schrieb Anna Falkowska <afalkows@umich.edu>:

> I made a form using ArchGenXML and want to use it to populate a table
> in a mysql database. So far I have not come across a good tutorial on
> how to do this. Someone suggested I use ZSQL methods. I understand how
> to create them, but how exactly would I call a ZSQL method with the
> information from my form?

Hi,

check the section on ZSQL in the Zope Book to understand how ZSQL works
but I suggest you proceed as follows.
Pass your form into a PythonScript to run checks pretty much like this:

request = context.REQUEST

for item in request.form.keys():
validate(item)

if no_errors:
context.SQL.someZSQLMethod(dictionary_of_items)
return context.thank_you_page()

else:
return context.error_page()

Charlie
--
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!
_______________________________________________
Zope-DB mailing list
Zope-DB@zope.org
http://mail.zope.org/mailman/listinfo/zope-db