[Twisted-Python] How to save the content(string) of a DOM node into a file?

Bob Ippolito bob at redivi.com
Mon Sep 15 19:15:00 MDT 2003


On Monday, Sep 15, 2003, at 20:41 America/New_York, Chris Armstrong 
wrote:

> On Mon, Sep 15, 2003 at 11:17:44AM -0700, suneetha velicheti wrote:
>> Hi,
>>   I wanted to save the content of a DOM node into a file and want my
>> browser to prompt me with "save as" window. I already set the browser
>> preferences. Right now the content of the node is just displaying in 
>> the
>> browser window. Instead of that I want to promt the user to save that
>> content into a file with "save as" option window. Are there any DOM 
>> helper
>> methods to do this?
>
> see the "write[pretty]xml" method.

I think he's talking about rigging the Content-Type header so that the 
browser thinks it doesn't know how to display the content, and will 
prompt the user to save the document.  It really has nothing to do with 
DOM at all.

Try:
	request.setHeader('content-type', 'application/octet-stream')

In your render method.

-bob





More information about the Twisted-Python mailing list