[Zope] Re: [Zope-dev] RFC: backward compatibility of PythonScript bindings for 2.6.4 / 2.7.0

Jeremy Hylton jeremy at zope.com
Wed Jan 21 11:44:56 EST 2004


On Wed, 2004-01-21 at 10:42, Brian Lloyd wrote:
> What I don't like is that it is somewhat magical, and now the 
> error you would get (probably 'None has no attribute xxx') if 
> the user doesn't have access to the container doesn't tell you 
> the real problem. 

What if you used a special object that would produce a useful error
message if the user tries to access the container.  Assuming an access
involves an attribute access:

class UnauthorizedContext:

    def __getattr__(self, attr):
        raise Unauthorized("user does not have access to context")

I'm sure the details aren't right, but I think the idea is clear enough.

Jeremy





More information about the Zope mailing list