James Y Knight wrote: > On Dec 15, 2005, at 3:01 PM, Jim Fulton wrote: > >> Normally an application will call the start_response callable when the >> application is called or when the result iterator is constructed, as >> shown in the first 2 examples. An application, or more commonly, a >> middleware component that provides it's own thread management might >> delay starting the response. A server should not begin iterating >> over the result until the start_response callable has been called." > > > But it's my understanding that this is valid: > > def test_calledStartResponseLate(self): > def application(environ, start_response): > start_response("200 OK", {}) > yield "Foo" > > start_response is called _inside_ the first iteration of the result. So > the server has to iterate at least once, even if start_response was not > called... > > I was led to believe this was a valid thing to do from the following > wording: > >> (Note: the application must invoke the start_response() callable >> before the iterable yields its first body string, so that the server >> can send the headers before any body content. However, this >> invocation may be performed by the iterable's first iteration, so >> servers must not assume that start_response() has been called before >> they begin iterating over the iterable.)
Aargh, I didn't see that, despite looking for it. I said I may have missed it. Hm. Jim -- Jim Fulton mailto:[EMAIL PROTECTED] Python Powered! CTO (540) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com