Skip to content

Commit

Permalink
Update to zope.app.wsgi 4.1 and remove workarounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Apr 27, 2017
1 parent ae821aa commit fc79a03
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
4 changes: 1 addition & 3 deletions setup.py
Expand Up @@ -17,8 +17,6 @@
# Zope Toolkit policies as described by this documentation.
##############################################################################
"""Setup for zope.app.form package
$Id: setup.py 81002 2007-10-24 01:19:47Z srichter $
"""
import os
from setuptools import setup, find_packages
Expand All @@ -36,7 +34,7 @@ def read(*rnames):
'zope.app.appsetup',
'zope.testing',
'zope.testrunner',
'zope.app.wsgi',
'zope.app.wsgi >= 4.1.0',
'webtest',
]

Expand Down
25 changes: 0 additions & 25 deletions src/zope/app/form/browser/tests/test_functional_i18n.py
Expand Up @@ -26,7 +26,6 @@
from zope.i18nmessageid import MessageFactory

from zope.app.wsgi.testlayer import http
from zope.app.wsgi.testlayer import FakeResponse
from zope.app.form.testing import AppFormLayer


Expand Down Expand Up @@ -73,29 +72,6 @@ class FieldContent(Persistent):
(re.compile(r"HTTP/1\.0 200 .*"), "HTTP/1.1 200 OK"),
])

class _FakeResponse(FakeResponse):
if str is bytes:
# Up through at least 4.0.0 of zope.app.wsgi, Py2 has a bug,
# assuming headers are in unicode already, or are decodable
# implicitly to ascii.
# See https://github.com/zopefoundation/zope.app.wsgi/issues/7.
def getHeaders(self):
headers = super(_FakeResponse, self).getHeaders()
result = []
for key, value in headers:
assert isinstance(key, str)
assert isinstance(value, str)
result.append((key.decode('latin-1'),
value.decode('latin-1')))
return result

# we also need to ensure we get something that can be printed
# in ascii and produce the same output as Py3.
def __str__(self):
return self.getOutput().decode('latin-1').encode("utf-8")



def test_suite():
def setUp(test):
wsgi_app = AppFormLayer.make_wsgi_app()
Expand All @@ -105,7 +81,6 @@ def _http(query_str, *args, **kwargs):
if not isinstance(query_str, bytes):
query_str = query_str.encode("ascii")
response = http(wsgi_app, query_str, *args, **kwargs)
response.__class__ = _FakeResponse
return response

test.globs['http'] = _http
Expand Down

0 comments on commit fc79a03

Please sign in to comment.