Re: SVN: Products.ZCatalog/trunk/ Handle `TypeErrors` in the KeywordIndex if an indexed attribute is a method with required arguments.

Tres Seaver <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
-----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          [email protected]
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-----

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.