Yes this would work.

What I meant by (it cannot be done) is that if you call a function
that returns json and that function returns a string containing a url,
it is not obvious that is supposed to be a redirection. You need some
logic client side.

I guess it depends on what haggis is trying to do.

Massimo

On Nov 2, 2:53 pm, Anthony <[email protected]> wrote:
> On Wednesday, November 2, 2011 2:36:53 PM UTC-4, haggis wrote:
>
> > Hello,
> > is it possible to return json to the calling jQuery.ajax() function
> > after access was denied by decorator @auth.requires_login()?
>
> > I know there is a possibility to specify a function when authorization/
> > authentication failed with
> > auth.settings.on_failed_authentication = myFunc and
> > auth.settings.on_failed_authorization = myFunc
>
> > I put this two lines in model db.py. However, I don't know how to just
> > return json containing a url to which the user should be redirected.
>
> Maybe your on_failed_authorization function could do:
>
> raise HTTP(200, 'your_url')
>
> Anthony

Reply via email to