[Freeipa-devel] [PATCH] radius work, please review

John Dennis jdennis at redhat.com
Thu Nov 29 22:53:13 UTC 2007


Karl MacMillan wrote:
> On Thu, 2007-11-29 at 16:15 -0500, Rob Crittenden wrote:
>> John Dennis wrote:
> 
> [...]
> 
>> 4. As you can see in each tool there is a bunch of duplicated code (all 
>> the error catching at the end for example). Do you know of a way we can 
>> generalize that in Python and put it into a client library?
>>
> 
> Decorators? (I think that is in python 2.4)

I'm pretty familiar with decorators, it's a nice feature, but I don't 
think it has application in this context. Decorators can be used to add 
meta-data to functions and/or alias the function to a specific use by 
returning a runtime generated function which end up being a "proxy" for 
the decorated function. This feature makes it wonderful for implementing 
RPC. But perhaps I'm not following your vision of how a decorator might 
be used to reduce the code duplication.

-- 
John Dennis <jdennis at redhat.com>




More information about the Freeipa-devel mailing list