[Soap-Python] Multiple decorators
azurIt
azurit at pobox.sk
Thu Sep 29 18:46:55 CEST 2011
Yes, i read this:
http://arskom.github.com/rpclib/reference/base.html?highlight=event#rpclib.EventManager
http://arskom.github.com/rpclib/manual/t_and_p.html?highlight=event
http://arskom.github.com/rpclib/manual/t_and_p.html?highlight=event
but i missed that UserDefinedContext and also example :( sorry.
If i understand you correctly, i need to create two services:
- one with methods that doesn't need authentication (and with no events)
- one with methods that needs authentication and with some events enabled
Is this correct ?
Does udc must be a class or it can be, for example, dictionary ?
What about my (2) ? How can i set something like 'permissions' for every method so that method_call event will have access to them when method is called ? I was using a decorator for all of this, for example:
@login_log_decor( send_mail=True, has_domain=True, perms={"and": ["aaa", "bbb"], "or": []} )
def myfunc(....):
Thank you very much!
azur
______________________________________________________________
> Od: "Burak Arslan" <burak.arslan at arskom.com.tr>
> Komu: azurIt <azurit at pobox.sk>
> Dátum: 29.09.2011 17:48
> Predmet: Re: [Soap-Python] Multiple decorators
>
> CC: soap at python.org
>On 29.09.2011 18:32, azurIt wrote:
>> 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 ?
>
>class AuthenticatedServiceBase(ServiceBase):
> pass
>
>AuthenticatedServiceBase.event_manager.add_listener('method_call',
>_check_login)
>
>and have your authenticated methods' service extend that.
>
>
>> 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 ?
>
>ctx.udc is your friend. conceptually, events and decorators do the same
>thing.
>
>did you actually read the manual? i talk about such scenarios. or maybe
>it's difficult to understand the documentation?
>
>best,
>burak
>
>
>
More information about the Soap
mailing list