[Zope-dev] SVN: Products.ZCatalog/trunk/ Handle `TypeErrors` in the KeywordIndex if an indexed attribute is a method with required arguments.

Tres Seaver tseaver at palladion.com
Thu Apr 21 15:00:54 EDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 04/21/2011 02:07 PM, Hanno Schlichting wrote:
> Log message for revision 121454:

<snip>

>   Protect against implicitly acquiring attributes for indexes.

<snip>

> Modified: Products.ZCatalog/trunk/src/Products/PluginIndexes/common/UnIndex.py
> ===================================================================
> --- Products.ZCatalog/trunk/src/Products/PluginIndexes/common/UnIndex.py	2011-04-21 06:27:40 UTC (rev 121453)
> +++ Products.ZCatalog/trunk/src/Products/PluginIndexes/common/UnIndex.py	2011-04-21 18:07:09 UTC (rev 121454)
> @@ -17,6 +17,7 @@
>  from logging import getLogger
>  import sys
>  
> +from Acquisition import aq_base
>  from BTrees.IIBTree import intersection
>  from BTrees.IIBTree import IITreeSet
>  from BTrees.IIBTree import IISet
> @@ -264,6 +265,9 @@
>          # self.id is the name of the index, which is also the name of the
>          # attribute we're interested in.  If the attribute is callable,
>          # we'll do so.
> +        has_attr = getattr(aq_base(obj), attr, _marker)
> +        if has_attr is _marker:
> +            return _marker
>          try:
>              datum = getattr(obj, attr)
>              if safe_callable(datum):

This is an API change:  it breaks code which deliberately uses
acquisition to supply defaults for indexing purposes.  There needs to be
some way to put it back, at least (maybe a zope.conf setting?)


Tres.
- -- 
===================================================================
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2wfuYACgkQ+gerLs4ltQ43UACghtYqQjy4zlpO9h8Jjr1dMBd5
37wAoKTiTYFvLKMtyIkVWDw0SycmfPtr
=ptTL
-----END PGP SIGNATURE-----



More information about the Zope-Dev mailing list