[Zope-dev] Re: hasattr implementation for Zope?

Dieter Maurer dieter at handshake.de
Sat May 28 04:16:42 EDT 2005


Tres Seaver wrote at 2005-5-27 08:22 -0400:
> ...
>As a local patch, this isn't too bad (one could even package it as a
>do-nothing-after-initialization product).  However, no redistributed
>product code should rely on the presence of a patched 'hasattr', but
>should use the 3 argument getattr instead.

I think this is *very* bad!

  It is quite difficult to get the "hasattr" emulation via
  "getattr" correct.

If you do not like a modified "__builtin__.hasattr" (which I can understand),
then provide at least a "__builtin__.zhasattr" (or similarly named) available
in restricted code and strongly recommend in the documentation to use this
variant of "hasattr" for any Zope/ZODB object.

-- 
Dieter


More information about the Zope-Dev mailing list