[Soap-Python] Multiple decorators
azurIt
azurit at pobox.sk
Thu Sep 29 17:32:50 CEST 2011
Thank you.
Problem is that i'm doing quite complex things in my decorator and for this i need to:
1.) call decorator only for selected methods - it is possible to filter this in events ?
2.) pass some parameters to decorator which differs per method (for example permissions needed to call a method)
3.) share variables between space 'before call' and 'after call', maybe this is possible via MethodContext ?
any ideas how this all could be done ?
azur
______________________________________________________________
> Od: "Burak Arslan" <burak.arslan at arskom.com.tr>
> Komu: azurIt <azurit at pobox.sk>
> Dátum: 29.09.2011 16:37
> Predmet: Re: [Soap-Python] Multiple decorators
>
> CC: soap at python.org
>On 29.09.2011 16:34, azurIt wrote:
>> is it somehow possible to use multiple decorators with @rpc/srpc ?
>>
>>
>
>Here's the magic from the rpclib.decorator module:
>
> argcount = f.func_code.co_argcount
> param_names = f.func_code.co_varnames[arg_start:argcount]
>
>if f is your decorator, the parameter names and numbers are going to be
>wrong. so no, use events. look at the relevant example in the source
>distribution and read the events section in the manual.
>
>If you're hell bent on using decorators, you can wrap @srpc. you'll most
>probably be on your own if you choose that though.
>
>that's going to make a fine FAQ entry btw :)
>
>best,
>burak
>
>
More information about the Soap
mailing list