Zope DTML Using MySQL IN with Z SQL

The syntax for using sql-safe DTML arguments within a MySQL IN query is surprisingly simple.
ZSQL:

SELECT title, price
FROM   products
<dtml-sqlgroup where> 
	<dtml-sqltest model multiple type="string"> 
</dtml-sqlgroup>


Python:

items = context.sql_select_products(model = ['ModelA', 'ModelB', 'ModelC', 'ModelD'])
Posted by
Snippet Viewed 1587 times.

Share your Zope DTML code snippets:

  • Get some recognition & link back to your site.

 

Submit | Browse

Most Recent zope dtml snippets

Most Viewed