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