[Zope-dev] bug in OFS/Traversable.py

Martijn Faassen faassen@vet.uu.nl
Thu, 13 Sep 2001 17:02:06 +0200


Hi there,

There appears to be a bug in Zope 2.4.1's OFS/Traversable.py. I've tried
to identify the same bug in the CVS, but oddly enough I couldn't find it.
There doesn't appear to be any Zope 2.4.1 CVS branch and the Zope 2.4
branch didn't have any changes to this file in 3 months, but doesn't
seem to have the same problem. Odd.

Anyway, the bug isn't a large one; just a few uses of 'has' where 'hasattr'
should be used (or there should be a line 'has = hasattr' somewhere near
'get = getattr').

Here's a diff that seems to fix the problem:

193c193
<                         if has(o, 'im_self'):
---
>                         if hasattr(o, 'im_self'):
195c195
<                         elif (has(get(object, 'aq_base', object), name)
---
>                         elif (hasattr(get(object, 'aq_base', object), name)

So again, this is true for Zope 2.4.1 (source release), while the CVS
does not appear to have the problem (but it just looks rather different
in other places as well, even though last change was 3 months ago; I do not
understand).

Anyway, just so the bug won't be present in any new release.

Regards,

Martijn