No it does not. Your solution is quite clean and of course works.

Thanx a lot!

On Nov 28, 2:37 pm, Anthony <abasta...@gmail.com> wrote:
> Does it have to be a response header? How about adding a flag as a URL arg
> or var:
>
> redirect(URL('index', vars=dict(success='True')))
>
> If you need to check it on the client side, you can access the query string
> in JS via window.location.search. Alternatively, you could have the 'index'
> function itself set the header based on the query string:
>
> def index():
>     if request.vars.success:
>         response.headers['success'] = 'True'
>
> Anthony
>
>
>
>
>
>
>
> On Monday, November 28, 2011 8:15:02 AM UTC-5, thodoris 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)

Reply via email to