[Zope] How do I access a ZSQL method in a python script?

Tom Smith tom@othermedia.com
Tue, 6 Nov 2001 11:52:56 +0000


On Tuesday, November 6, 2001, at 06:59 PM, prabu wrote:

> How do I access a ZSQL method in a python script?
> Prabu

This calls a sql query to get child categories and returns a list of 
category_ids.


(in the params field I have category_id)

results = context.select_child_categories_sql(category_id=category_id) # 
get a list of categories.

children = [ ]
for i in results: # I don't know why but you seem to have to loop 
through the result set ?!
     children.append(i.category_id)

# do something fancy with the list here...

return children


--
tom smith | tom@othermedia.com
http://www.othermedia.com/blog
3rd Floor, The Pavilion, Newhams Row, London, SE1 3UZ
0207 089 5959