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

Shannon -jj Behrens jj@nttmcl.com
Thu, 6 Mar 2003 14:43:19 -0800


Well, I'm new to this list, but I had a similar problem.  I just stuck the 
meta_type, etc. in the catalog using additional Metadata.  Afterally, the 
attributes you're referring to are small.

Best Regards,
-jj

On Thu, Mar 06, 2003 at 03:30:01PM -0700, 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 )

-- 
Hacker is to software engineer as 
Climbing Mt. Everest is to building a Denny's there.