On Tuesday, August 2, 2011 10:23:39 AM UTC-4, Alexander Cabezas wrote: > > Hello, > > I don't get the correct behavior when update response.headers with > onaccept parameter on auth.login function. Here I'm trying to redirect > with Javascript after user logins but it redirect to "default/ > index.load", below: > > > # default.py > def login(): > nc = request.vars.nc or 'default' > nf = request.vars.nf or 'index' > next = URL(r=request, c=nc, f=nf)
The 'login' function is called with the '.load' extension, so the URL function is propogating the '.load' extension (if you don't specify the extension in the URL function, it defaults to request.extension, which is the extension of the current request). You could change nf to 'index.hmtl' or explicitly set extension='html', but that will show 'index.html' in the URL, which you probably don't want. To force no extension at all (which web2py will then interpret as .html), do: next = URL(r=request, c=nc, f=nf, extension=False) # extension='' would work as well See http://web2py.com/book/default/chapter/04#URL. Anthony

