No. You should define the 'user; action only one (for example in
default.py)
But, you also need the following in the model

auth.settings.login_url = URL(r=request,c='default',f='user/login')
auth.settings.on_failed_authorization = URL
(r=request,c='default',f='user/on_failed_authorization')

so all models know where to find it.


On Jul 6, 1:32 pm, Jose <jjac...@gmail.com> wrote:
> On 6 jul, 18:16, mdipierro <mdipie...@cs.depaul.edu> wrote:> Not sure I 
> understand. You need only one
>
> > > def user ():
> > >     return dict(form=auth())
>
> > If you need to decorate lots of functions with @auth.requires_login(),
> > you can do
>
> > if not request.function in ['index','other_allowed_function'] and not
> > auth.is_logged_in():
> >     redirect(URL(r=request,f='user/login'))
>
> I refer to that if I define:
>
> def user ():
>     return dict(form=auth())
>
> in default.py, I can decorate only the functions of default.py. If I
> need to decorate a function in another_controller.py, I cannot do it.
> I must define again:
>
> def user ():
>     return dict(form=auth())
>
> in another_controller.py
>
> Jose
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to