[ZCM] [ZC] 752/ 1 Request "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 06:18:52 -0500
Issue #752 Update (Request) "zcatalog doesn't catch exceptions adding non existing attributes to metadata through python sctipts"
Status Pending, Catalog/bug+solution medium
To followup, visit:
http://collector.zope.org/Zope/752
==============================================================
= 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.
==============================================================