[Zope] Get Access to Object from its record in the ZCatalog

Edward Pollard pollej@uleth.ca
Thu, 06 Mar 2003 15:30:01 -0700


I'm pulling my hair out here. I'm sure the answer is simple.

How can I get to properties of an object from its ZCatalog entry?

I'm iterating through results, and want to do something special if the
result is a record for a PDF file. I know how to check the file to see
if its a PDF, but ZCatalog does not keep track of all the file contents.
I know there is a way to resolve the record ID into the actual object,
but I forget how and cannot find a reference to it.

Thanks,

Edward

----
For clarity, here is some of my code. I am looking for what to use
instead of ??
zIndex_Catalog is my Catalog. zIndexFileItem is my CatalogAware wrapper
ZClass for File.

searchresults = list(context.zIndex_Catalog.searchResults(blah blah
search params blah blah))
searchresults.sort( lambda x, y: cmp(x.title, y.title))
for result in searchresults:
if ((??.meta_type == 'File') or (??.meta_type == 'zIndexFileItem')):
     if (??.getContentType == "application/pdf"):
       PDF Specific Code Here