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

Edward Muller edwardam@interlix.com
07 Mar 2003 00:26:02 -0600


tal:define="url python: result.getpath(result.data_record_id_)"

and results are defined as

<div tal:define="results here/SiteCatalog">

somewhere above that ..


On Thu, 2003-03-06 at 16:30, Edward Pollard wrote:
> 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
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
-- 
Edward Muller

Interlix - President

Web Hosting - PC Service & Support
Custom Programming - Network Service & Support

Phone: 417-862-0573
 Cell: 417-844-2435
  Fax: 417-862-0572

http://www.interlix.com