[Zope] Finding an object in a folder

Alec Mitchell apm13 at columbia.edu
Sun May 29 02:09:14 EDT 2005


On Saturday 28 May 2005 01:26 am, Dieter Maurer wrote:
> Paul Winkler wrote at 2005-5-27 11:08 -0400:
> >On Fri, May 27, 2005 at 03:26:04PM +0200, Dieter Maurer wrote:
> >> A higher risk comes from the fact that some Python packages may
> >> rely on the broken "hasattr" behaviour. That's the reason why
> >> the problem is not fixed in Python itself.
> >
> >And that's a very good reason not to monkeypatch it.
> >We can't have arbitrary third-party packages breaking when
> >they are used with Zope. Such bugs could be maddeningly difficult
> >to diagnose and find.
> >
> >Anyway, Jim has made a papal edict on zope-dev:
> >We will never monkeypatch hasattr in the zope core.
>
> But hopefully we will get a decent "safe_hasattr" (or similar),
> get it used at least in all Zope core code,
> rather than that each of the 700 occurrencies tries its
> own "hasattr" emulation via "getattr".

Well, Plone at least has one for 2.1 until zope gets one:

from Products.CMFPlone import shasattr

also:

from Products.CMFPlone import safe_callable

shasattr is essentially a copy of the AT one, but is importable into trusted. 
code.

Alec


More information about the Zope mailing list