On Thursday 13 March 2008, Suha Onay wrote:

> How is it possible to set the HTTP header of the link to this file
> (qqq.lqp )?
>
> f= open(os.path.join(LQS.WEB_SERVER, 'xxx', 'qqq.lqp'), 'w')
> f.write(fileInput)
> f.close()
>
> return [
>     T.a(href="/xxx/qqq.lqp")['Save'],
>     webform.renderForms()[FORM_LAYOUT],
> ]

The HTTP header cannot be set on the link; the header should be set when 
serving the file download. This is just a matter of calling setHeader() on 
the request. I'm not very familiar with Nevow, so I don't know where that 
call should be placed.

By the way, instead of generating a file on the server and offering that for 
download, it might be simpler to send the data directly to the client. That 
way you don't have to worry about uniqueness of file names, cleaning up 
files when they are no longer needed etc.

Bye,
                Maarten

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to