The problem is that add_team is not an action. The other problem is
the order of decorators.
In this case
@auth.requires_login()
@service.jsonrpc
def add_team(name, cap):
#function uses auth.user.id
You register the service (jsonrpc) before requiring_login therefore
login would not be used. You may try
@service.jsonrpc
@auth.requires_login()
def add_team(name, cap):
#function uses auth.user.id
This may work but I have not tried. If it does, let me know.
On May 7, 12:21 pm, MikeEllis <[email protected]> wrote:
> Massimo,
> Could you please elaborate a bit further? Is this restriction
> something peculiar to auth.requires_login? or service.jsonrpc? or
> both? Or is it something that applies to any use of multiple
> decorators in web2py?
> Thanks,
> Mike
>
> On May 7, 10:32 am, mdipierro <[email protected]> wrote:
>
> > You cannot do this:
>
> > @auth.requires_login()
> > @service.jsonrpc
> > def add_team(name, cap):
> > #function uses auth.user.id