[Zope-dev] Re: Post-authentication hook
robert
robert@redcor.ch
Tue, 10 Jun 2003 21:23:58 +0200
Please do,
I need it for some some extra authentication against a mysql db.
Robert
Am Dienstag, 10. Juni 2003 20:41 schrieb Evan Simpson:
> Dieter Maurer wrote:
> > We had discussed the post-authentication hook in connection
> > with role based skin selection but we never had it implemented.
>
> I have, and it even fits here in the margin. Shall I pop it into the
> Collector?
>
> 242a243
>
> > self._post_traverse =3D post_traverse =3D []
>
> 363a365
>
> > del self._post_traverse
>
> 434a437,439
>
> > if post_traverse:
> > exec_callables(post_traverse)
>
> 444a450,453
>
> > def post_traverse(self, f, args):
> > """Set a callable object and argument tuple
> > to be combined if traversal succeeds"""
> > self._post_traverse.append((f, tuple(args)))
>
> 445a455,470
>
> > def exec_callables(callables):
> > for (f, args) in callables:
> > try:
> > f(*args)
> > except (ArithmeticError, AttributeError, FloatingPointError,
> > IOError, ImportError, IndexError, KeyError,
> > OSError, OverflowError, TypeError, ValueError,
> > ZeroDivisionError):
> > # Only catch exceptions likely to be logic errors.
> > # We shouldn't catch Redirects, Unauthorizeds, etc. since
> > # the programmer may want to raise them deliberately.
> > from zLOG import LOG, ERROR
> > import sys
> > LOG('PostTraverse', ERROR,
> > 'Error while invoking hook: "%s"' % `f`,
> > error=3Dsys.exc_info())
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
=2D-=20
mit freundlichen Gr=FCssen
Robert Rottermann
www.redCOR.ch