[Zope-DB] SQL Oracle and Drop Down Boxes
Dieter Fischer
dieter.fischer at grid-it.ch
Wed Nov 12 18:20:25 EST 2003
> I am new to Zope and Python and Web Development really. I am
> trying to do
> something I am sure must be very simple. I want to query an
> Oracle database
> table using SQL and populate a drop down box with the
> returned values. Can
> anybody point me in the direction of a simple example?
Hello Rob
I'm using for that the formulator product:
http://zope.org/Members/infrae/Formulator
Having an SQL-Method 'countries_sql' like this:
<code>
SELECT code AS code,
text AS text
FROM code
WHERE domain = 'COUNTRY'
</code>
which is called by a python script 'countries_py':
<code>
result = []
for sql in container.countries_sql():
tuple = sql['code'], sql['text']
result.append(tuple)
return result
</code>
you can call this in the form TALES/Items with:
<code>
python:field.countries_py()
</code>
Works fine and is resusable.
Regards
Dieter
More information about the Zope-DB
mailing list