[CMF-checkins] CVS: CMF/CMFDefault - MembershipTool.py:1.43
casey at zope.com
Tue Feb 10 17:13:48 EST 2004
On Tue, 10 Feb 2004 22:30:52 +0100
Florent Guillaume <fg at nuxeo.com> wrote:
> Casey Duncan wrote:
> >>You're right about the aq_base, but I'll code it differently:
> >> if hasattr(aq_base(members), id):
> >> folder = getattr(members, id)
> >> ...
> > Except that hasattr swallows conflict errors... 8^/
> It does ? Could you expand on this, that's news to me...
Try this on for size:
Python 2.3.3 (#1, Jan 20 2004, 22:38:52)
[GCC 3.2.2 [FreeBSD] 20030205 (release)] on freebsd5
Type "help", "copyright", "credits" or "license" for more information.
>>> class C:
... def __getattr__(self, x):
... raise SystemExit, 'Aieee!'
>>> c = C()
>>> hasattr(c, 'caffeine')
>>> getattr(c, 'caffeine')
hasattr swallows all exceptions, including SystemExit as you can see.
More information about the CMF-checkins