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

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? Thanks for the help, Suneetha. _________________________________________________________________ Try MSN Messenger 6.0 with integrated webcam functionality! http://www.msnmessenger-download.com/tracking/reach_webcam

I am trying to write a client for IRC that handles its own network data parsing, but has multiple Tkinter Dialogs. I was wondering if there was a decent example of this, or something similar, and where it would be. Tutorials work too except I learn better by examples of implementation for some reason. Thanks in advance, Daniel

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. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://twistedmatrix.com/users/radix.twistd/

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

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?
So you're serving XML from a Twisted web server? I think you want to call "request.setHeader('content-type', 'application/octet-stream')", or something like that. That should convince the browser to save it rather than display it (this applies to pretty much anything you could serve, not just XML). There's also a Content-Disposition header that is supposed to do this, but I've never been able to figure out how to make it work reliably across different browsers. -Andrew.
participants (5)
-
Andrew Bennetts
-
Bob Ippolito
-
Chris Armstrong
-
Daniel Hawton
-
suneetha velicheti