You cannot do this:
@auth.requires_login()
@service.jsonrpc
def add_team(name, cap):
#function uses auth.user.id
but you can do
@service.jsonrpc
def add_team(name, cap):
#function uses auth.user.id
@auth.requires_login()
def call(): return service()
On May 7, 9:17 am, Carl <[email protected]> wrote:
> I'd like to use several decorators on a function
>
> e.g.,
>
> @auth.requires_login()
> @service.jsonrpc
> def add_team(name, cap):
> #function uses auth.user.id
>
> In testing I've realised that service.jsonrpc is working but
> auth.requires_login isn't.
> ie if a user is not logged in then service.jsonrpc is called and it
> calls add_team() with its parameters. add_team then fails when it
> tries to use the auth instance.
>
> Is it my syntax? my understanding of decorators? or what?
>
> thanks