Re: [web2py] Re: Changing redirect for @auth.requires_login()

2010-02-04 Thread Thadeus Burgess
yes but it wont. the redirect is bug since it creates the strings when you instantiate the Auth class, the urls set in stone. So >>>auth = Auth(globals()) >>>auth.settings.controller = 'myauth' >>>print auth.settings.login_next '/init/default/index' -Thadeus On Wed, Feb 3, 2010 at 9:06 PM

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread weheh
I think what everyone's trying to say is that if you don't set auth.settings.login_next then by default, the redirect after login will be to the decorated controller that sent you to login to begin with. So make sure there is no auth.settings.login_next in your model file (db.py). -- You received

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread mdipierro
It should do that if you call login via @auth.requires_login() On Feb 3, 4:24 pm, Dane wrote: > Thanks! > > As an aside, I wonder why redirecting to the last accessed controller > function after login isn't the default behavior. Isn't this by far the > most common use case? > > On Feb 3, 2:25 pm

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Dane
Thanks! As an aside, I wonder why redirecting to the last accessed controller function after login isn't the default behavior. Isn't this by far the most common use case? On Feb 3, 2:25 pm, Wes James wrote: > You will want to do it in your controller for each view function you have. > > I have s

Re: [web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Wes James
You will want to do it in your controller for each view function you have. I have some like this: if auth.is_logged_in(): redirect(URL(r=request,c='default',f='apage')) or something like @auth.requires_login() def change_password(): return dict(form=auth.change_password(next=URL(r=

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Dane
Thanks, but I still don't understand.. if I set it in db.py, won't that permanently send all my login redirects to the same function? But I want the redirect to change depending on the part of the site my users try to access. Do I use a property on request for this? On Feb 3, 1:53 pm, Wes James w

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Dane
Thanks, but I still don't understand.. if I set it in db.py, won't that permanently send all my login redirects to the same function? But I want the redirect to change depending on the part of the site my users try to access. Do I use a property on request for this? On Feb 3, 1:53 pm, Wes James w

Re: [web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Wes James
db.py On Wed, Feb 3, 2010 at 11:12 AM, Dane wrote: > Thanks, and where would I set this to get a redirect to the function > being accessed? In the body of the controller function itself? I'm new > to python and decorators, but I assumed nothing in the decorated > function would run. > > > On Feb

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread Dane
Thanks, and where would I set this to get a redirect to the function being accessed? In the body of the controller function itself? I'm new to python and decorators, but I assumed nothing in the decorated function would run. On Feb 3, 10:37 am, mdipierro wrote: > auth.settings.login_next = URL(.

[web2py] Re: Changing redirect for @auth.requires_login()

2010-02-03 Thread mdipierro
auth.settings.login_next = URL(...) On Feb 3, 12:03 am, Dane wrote: > Hey all, I've been using the @auth.requires_login() decorator and I > love the simplicity. It was also pretty easily to hook it into google > account authentication after a bit of searching on this group. My only > problem with