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 returns.
- 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.