Chris Withers wrote at 2005-5-25 21:03 +0100:
...
I strongly argue against it. Fix "hasattr" in the Zope context, instead!
Make it so! :-)
_marker = [] def hasattr(obj, attr, marker): a = getattr(obj, attr, _marker) return a is not _marker import __builtin__ __builtin__.hasattr = hasattr Easy enough, isn't it? Way easier than to change "hasattr" anywhere it is now used. Now, there need only to be someone who checks it in.
if getattr(thefolder.aq_inner.aq_explicit,the_id,None):
You are aware that this is in general *NOT* an emulation of "hasattr".
I didn't say it was ;-)
It may fail e.g. for properties.
How would it fail for properties?
It fails for everything with a false value (None, 0, '', [], ...). Properties may have a false value.
And it would be so easy to fix "hasattr" ;-)
then why haven't you done it? ;-)
I do not have write access to the Zope repository (because ZC requires full patent indemnification to grant it and I am unwilling to promise this). -- Dieter