[Zope3-checkins] SVN: Zope3/trunk/ Merged from 3.2 branch:
Jim Fulton
jim at zope.com
Sat Dec 24 11:46:24 EST 2005
Log message for revision 41024:
Merged from 3.2 branch:
------------------------------------------------------------------------
r40918 | jim | 2005-12-20 13:29:49 -0500 (Tue, 20 Dec 2005) | 2 lines
r40916 | jim | 2005-12-20 13:24:48 -0500 (Tue, 20 Dec 2005) | 3 lines
Make sure that the wsgi server actually passes the iterable from the
application to the server.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/server/http/tests/test_wsgiserver.py
U Zope3/trunk/src/zope/server/http/wsgihttpserver.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2005-12-24 16:45:02 UTC (rev 41023)
+++ Zope3/trunk/doc/CHANGES.txt 2005-12-24 16:46:23 UTC (rev 41024)
@@ -35,6 +35,9 @@
Bug Fixes
+ - Fixed the plumbing in ZServer so that attempts to return large
+ output efficiently using iterators can actually succeed.
+
- Uodated to a new version of twisted that fixes a bug in
calling request bidy stream read methods without passing
arguments. http://www.zope.org/Collectors/Zope3-dev/521.
Modified: Zope3/trunk/src/zope/server/http/tests/test_wsgiserver.py
===================================================================
--- Zope3/trunk/src/zope/server/http/tests/test_wsgiserver.py 2005-12-24 16:45:02 UTC (rev 41023)
+++ Zope3/trunk/src/zope/server/http/tests/test_wsgiserver.py 2005-12-24 16:46:23 UTC (rev 41024)
@@ -13,6 +13,7 @@
$Id$
"""
+import StringIO
import unittest
from asyncore import socket_map, poll
from threading import Thread
@@ -107,7 +108,7 @@
request = publish(request)
response = request.response
start_response(response.getStatusString(), response.getHeaders())
- return response.consumeBody()
+ return response.consumeBodyIter()
td.setThreadCount(4)
# Bind to any port on localhost.
@@ -187,7 +188,21 @@
# conflicts.
self.testResponse(path='/conflict?wait_tries=10', status_expected=409)
+ def test_server_uses_iterable(self):
+ # Make sure that the task write method isn't called with a
+ # str or non iterable
+ class FakeTask:
+ getCGIEnvironment = lambda _: {}
+ class request_data:
+ getBodyStream = lambda _: StringIO.StringIO()
+ request_data = request_data()
+ setResponseStatus = appendResponseHeaders = lambda *_: None
+ def write(self, v):
+ if isinstance(v, str):
+ raise TypeError("Should only write iterables")
+ list(v)
+ self.server.executeRequest(FakeTask())
def test_suite():
loader = unittest.TestLoader()
Modified: Zope3/trunk/src/zope/server/http/wsgihttpserver.py
===================================================================
--- Zope3/trunk/src/zope/server/http/wsgihttpserver.py 2005-12-24 16:45:02 UTC (rev 41023)
+++ Zope3/trunk/src/zope/server/http/wsgihttpserver.py 2005-12-24 16:46:23 UTC (rev 41024)
@@ -60,7 +60,7 @@
return fakeWrite
# Call the application to handle the request and write a response
- task.write(''.join(self.application(env, start_response)))
+ task.write(self.application(env, start_response))
class PMDBWSGIHTTPServer(WSGIHTTPServer):
@@ -83,7 +83,7 @@
# Call the application to handle the request and write a response
try:
- task.write(''.join(self.application(env, start_response)))
+ task.write(self.application(env, start_response))
except:
import sys, pdb
print "%s:" % sys.exc_info()[0]
More information about the Zope3-Checkins
mailing list