[Twisted-Python] A Twisted Web Question....

Glyph Lefkowitz glyph at twistedmatrix.com
Sun Dec 28 23:39:45 EST 2003

On Dec 28, 2003, at 7:57 PM, JD wrote:

> Is this the right order for doing this?

You can do it in any order.  Basically, the rules are thus:

	- If you return a string, the framework will automatically call 
request.write(result); request.finish() for you when the method 

	- The request must be finish()ed or the page render will never 
complete in the browser.

	- If you return NOT_DONE_YET, nothing will happen automatically, and 
you can call request.write(...) at your leisure and request.finish() 
when you're done with it.  This includes in a callback of a Deferred 
(the usual use case), in another form of network callback, 
synchronously before you return NOT_DONE_YET, or whenever.  
NOT_DONE_YET just means "Do not have the framework call write() and 
finish() on the request automatically.)  The caveat is that you then 
MUST call finish(), or the page will hang forever in the browser.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20031228/d3f89ed7/attachment.pgp 

More information about the Twisted-Python mailing list