[Zope] getting at ZCatalog data object in Python

Dieter Maurer dieter at handshake.de
Mon Nov 17 13:57:05 EST 2003


Tom P. Allred wrote at 2003-11-16 17:06 -0500:
 > I'd like to return the data object a ZCatalog entry points to so a ZPT can
 > display the data.  Currently I'm doing it in a 2-step process where a Python
 > script finds/returns the catalog entry and the ZPT uses getObject to define
 > a variable to get at the actual data.  What I want to do is have the Python
 > script find the catalog entry then return the actual data object to the ZPT.

The Python Script can use "getObject" in the same way as the ZPT, e.g.

    ....
    return [x.getObject() for x in Catalog(queryspec)]


Note, that "getObject" is a potentially expensive operation.
You would not like to call it on hundreds/thousands of objects
(especially not, when you later use only a handful).

-- 
Dieter



More information about the Zope mailing list