[zope2-tracker] [Bug 142399] Re: hasattr_unacquired

dmaurer dieter at handshake.de
Sun May 16 01:48:17 EDT 2010


The primary purpose of the proposed feature is to get a safe way to ask whether given object "o" truely has attribute "a" i.e. does not acquire it.
This implies the following semantics:

'hasattr_unacquired(o,a) == True if and only if "getattr(o, a) is
obtained by looking at "o" only (and not at its acquisition context)'.

It means also, that "hasattr_unacquired(o, a)" should return "True", when "o" truely has "a" but the current user cannot
access "a". Should the user access such an attribute after the test, he will get an "Unauthorized".


One of my primary usage idioms looks like:

     if not hasattr_unacquired(o, id):
        # create child "id"
       ...
     child = getattr(o, id)

-- 
hasattr_unacquired
https://bugs.launchpad.net/bugs/142399
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list