i tried raise HTTP(303,location="url",HEADER_TEST=True) but i can't find the HEADER_TEST header passed, is this still valid for recent version of web2py?
On Monday, November 28, 2011 at 10:43:00 PM UTC+8, Massimo Di Pierro wrote: > > Anthony's response suggests a better way to solve your problem yet I > can see people wanting to forward headers. This is possible. > > redirect(URL(...)) > > is the same as > > raise HTTP(303,location=URL(...)) > > the named arguments of HTTP are headers so you can do: > > raise HTTP(303,location=URL(...),success=True) > > or (forward all headers) > > raise HTTP(303,location=URL(...),**request.headers) > > On Nov 28, 7:15 am, thodoris <pasxi...@gmail.com> wrote: > > I want to do the following: > > > > I want to add a key to response.headers > > > > response.headers['success']='True' > > > > after a successful file upload and also redirect. > > > > The problem is that i also want to redirect after successful upload > > but redirect makes a new reasponse.headers and i lose the key i want > > to add. > > > > Is there a way to solve this? > > > > When upload fails and i don't get redirected i can see my key in the > > headers. > > > > My code is: > > > > @auth.requires_login() > > def upload(): > > db.reactable.id.default = request.args(0) > > form=SQLFORM(db.table) > > response.headers['success']='False' > > if form.accepts(request.vars,session): > > response.headers['success']='True' > > session.flash="Record added" > > redirect(URL('index')) > > return dict(form=form) > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.