[Zope3-checkins]
SVN: Zope3/branches/stephan_and_jim-response-refactor/src/zope/
Fixed all zope.app.publication bugs.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Sep 7 00:29:44 EDT 2005
Log message for revision 38335:
Fixed all zope.app.publication bugs.
Changed:
U Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/httpfactory.py
U Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/tests/test_httpfactory.py
U Zope3/branches/stephan_and_jim-response-refactor/src/zope/publisher/browser.py
-=-
Modified: Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/httpfactory.py
===================================================================
--- Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/httpfactory.py 2005-09-07 03:56:29 UTC (rev 38334)
+++ Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/httpfactory.py 2005-09-07 04:29:43 UTC (rev 38335)
@@ -63,8 +63,19 @@
self._db = db
self._publication_cache = {}
- def __call__(self, input_stream, env):
+ def __call__(self, input_stream, env, output_stream=None):
"""See `zope.app.publication.interfaces.IPublicationRequestFactory`"""
+ # XXX BBB
+ try:
+ env.get
+ except AttributeError:
+ import warnings
+ warnings.warn("Can't pass output streams to requests anymore",
+ DeprecationWarning,
+ 2)
+ env, output_stream = output_stream, env
+
+
method = env.get('REQUEST_METHOD', 'GET').upper()
request_class, publication_class = chooseClasses(method, env)
Modified: Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/tests/test_httpfactory.py
===================================================================
--- Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/tests/test_httpfactory.py 2005-09-07 03:56:29 UTC (rev 38334)
+++ Zope3/branches/stephan_and_jim-response-refactor/src/zope/app/publication/tests/test_httpfactory.py 2005-09-07 04:29:43 UTC (rev 38335)
@@ -33,9 +33,8 @@
from zope.app.publication import interfaces
class DummyRequestFactory(object):
- def __call__(self, input_stream, output_steam, env):
+ def __call__(self, input_stream, env):
self.input_stream = input_stream
- self.output_steam = output_steam
self.env = env
return self
Modified: Zope3/branches/stephan_and_jim-response-refactor/src/zope/publisher/browser.py
===================================================================
--- Zope3/branches/stephan_and_jim-response-refactor/src/zope/publisher/browser.py 2005-09-07 03:56:29 UTC (rev 38334)
+++ Zope3/branches/stephan_and_jim-response-refactor/src/zope/publisher/browser.py 2005-09-07 04:29:43 UTC (rev 38335)
@@ -211,7 +211,7 @@
# Set this to True in a subclass to redirect GET requests when the
# effective and actual URLs differ.
- use_redirect = False
+ use_redirect = False
def __init__(self, body_instream, environ, response=None):
self.form = {}
@@ -279,7 +279,7 @@
# Check whether this field is a file upload object
# Note: A field exists for files, even if no filename was
# passed in and no data was uploaded. Therefore we can only
- # tell by the empty filename that no upload was made.
+ # tell by the empty filename that no upload was made.
key = item.name
if (hasattr(item, 'file') and hasattr(item, 'filename')
and hasattr(item,'headers')):
@@ -609,18 +609,19 @@
'GATEWAY_INTERFACE': 'TestFooInterface/1.0',
}
- if environ:
+ if environ is not None:
# XXX BBB
try:
- _testEnv.update(environ)
+ environ.get
except AttributeError:
import warnings
warnings.warn("Can't pass output streams to requests anymore",
DeprecationWarning,
2)
environ, form, skin, outstream = form, skin, outstream, environ
- _testEnv.update(environ)
-
+
+ _testEnv.update(environ)
+
if kw:
_testEnv.update(kw)
if body_instream is None:
@@ -645,6 +646,7 @@
else:
directlyProvides(self, IDefaultBrowserLayer)
+ # XXX BBB
self.response.outstream = outstream
def _createResponse(self):
@@ -669,7 +671,7 @@
content_type = 'text/plain'
self.setHeader('x-content-type-warning', 'guessed from content')
self.setHeader('content-type', content_type)
-
+
body, headers = super(BrowserResponse, self)._implicitResult(body)
body = self.__insertBase(body)
return body, headers
@@ -726,7 +728,7 @@
def testBody(self):
return self._body
-
+
def outputBody(self):
import warnings
warnings.warn("Can't pass output streams to requests anymore",
@@ -740,8 +742,8 @@
+ "\r\n\r\n"
)
self.outstream.write(''.join(self.result.body))
-
+
def isHTML(str):
"""Try to determine whether str is HTML or not."""
s = str.lstrip().lower()
More information about the Zope3-Checkins
mailing list