[ZCM] [ZC] 752/ 2 Reject "zcatalog doesn't catch exceptions adding non existing attributes to metadata through python sctipts"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin@zope.org
Thu, 02 Jan 2003 07:08:34 -0500


Issue #752 Update (Reject) "zcatalog doesn't catch exceptions adding non existing attributes to metadata through python sctipts"
 Status Rejected, Catalog/bug+solution medium
To followup, visit:
  http://collector.zope.org/Zope/752

==============================================================
= Reject - Entry #2 by htrd on Jan 2, 2003 7:08 am

 Status: Pending => Rejected

This is a duplicate of #753

As described in #753, I will include this (or something similar) in 2.7 
________________________________________
= Request - Entry #1 by olivluca on Jan 2, 2003 6:18 am


Uploaded:  "catalog.patch"
 - http://collector.zope.org/Zope/752/catalog.patch/view
I want to catalog some attributes without acquisition because they make sense only in the context of the object and not of its contained objects.
Since it's not currently possible to specify this to the current indexes/metadata, it was suggested to me in the mailing list to use a python script and index that, i.e.:

attr=getattr(context.aq_explicit,'MyAttrName')
if callable(attr): attr=attr()
return attr


the problem is that if the attribute is missing this script will raise an exception. The exception is normally caught by the index so that it will know not to index this object, but it isn't caught if it's used by the metadata in Catalog.py.

Attached is a patch against zope 2.6.1b1 that catches the exception while adding the metadata.


==============================================================