[web2py] Re: can auth.settings.on_failed_authorizatio raise http 403 error

2011-10-19 Thread Anthony
You should do: auth.settings.on_failed_authorization = fff You were calling the function fff() instead of assigning it to on_failed_authorization. Auth will call the function itself at the appropriate time. Anthony On Wednesday, October 19, 2011 10:21:18 AM UTC-4, d wrote: > > Hi All, > > I

[web2py] Re: can auth.settings.on_failed_authorizatio raise http 403 error

2011-10-19 Thread d
Thanks Anthony, After change to auth.settings.on_failed_authorization = fff for controller which requires log in and if user not logged in, it redirect to log in page. But purpose of using fff function is to raise http error but not redirecting to log in page. def fff(): raise HTTP(403, "H

[web2py] Re: can auth.settings.on_failed_authorizatio raise http 403 error

2011-10-19 Thread Anthony
I think you actually want: auth.settings.on_failed_authentication = fff Note, authentication rather than authorization. I believe on_failed_authentication will be called before any redirect to the login page, and on_failed_authorization gets called after login if the condition for authorizatio

[web2py] Re: can auth.settings.on_failed_authorizatio raise http 403 error

2011-10-19 Thread d
Thanks a lot for reply. It is the problem. And there is minor change in fff function needed def fff(args): raise HTTP(403, "HTTP 403: Not authenticated to access this URL.") because if do not put args in fff(), it complains error Now it works fine. Thanks a lot! This forum is really useful

Re: [web2py] Re: can auth.settings.on_failed_authorizatio raise http 403 error

2011-10-19 Thread Bruno Rocha
On Wed, Oct 19, 2011 at 1:31 PM, d wrote: > so, any idea where is problem? is it because fff() function is not > right? > Any @auth. decorators first check if the user is logged in. So it is checking for logged in user before fire your fff function. You can supress (only in trunk) with require