[Freeipa-devel] [PATCH] Add exception callback (exc_callback) to baseldap.py classes.

Pavel Zůna pzuna at redhat.com
Wed May 12 17:19:42 UTC 2010


On 2010-05-10 20:38, Rob Crittenden wrote:
> Pavel Zuna wrote:
>> The new callback enables plugin authors to supply their own handler
>> for ExecutionError exceptions generated by calls to ldap2 made from
>> the execute method of baseldap.py classes that extend CallbackInterface.
>>
>> Pavel
>
> I don't see any reference to EXC_CALLBACKS other than in registration.
> It looks like this provides a registration system then just calls the
> top exc_callback call.
My mistake, fixed patch attached.

> I see the default exc_callback() is just a raise. I think this should
> always be called last to raise the exception if things get that far.
> This way the plugin author doesn't have to remember to raise themselves
> if whatever condition they're looking for isn't met (which your second
> patch doesn't do).
We can't always call the default callback last, because all registered 
callbacks are called in a row and therefore the exception would always 
be raised. We want to be able to suppress exceptions.

Just to make things a little more clear: The default callbacks (the 
{pre,post,exc}_callback methods) are there to be overridden by plugin 
authors. Registering new callbacks is a way to extend existing plugins.

I also modified the way we call exception callbacks in this version of 
the patch, so that we can simulate that nothing went wrong even for 
ldap2 calls that return values. Also if a callback raises an 
ExecutionError, the callbacks called next have a chance to handle it.

> I like where this is going, just needs a little more work.
>
> rob

Pavel
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pzuna-freeipa-0004-exc_callback.patch
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20100512/4dfbfb8f/attachment.ksh>


More information about the Freeipa-devel mailing list