21 Jan
2004
21 Jan
'04
4:44 p.m.
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