Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The PUT views should return an empty bytes string.
If they don't, on Python 3 we run afoul of the zope.publisher rule that says that unicode response bodies need to have a content-type. But since the put view never sets a content type (due to being a redirect), we get a TypeError instead: ``` File "/py35/zope/app/wsgi/testlayer.py", line 210, in http response = request.get_response(wsgi_app) File "/py35/webob/request.py", line 1316, in send application, catch_exc_info=False) File "/py35/webob/request.py", line 1283, in call_application output.extend(app_iter) File "/py35/zope/app/wsgi/testlayer.py", line 94, in __call__ for entry in self.wsgi_stack(environ, application_start_response): File "/py35/zope/app/wsgi/testlayer.py", line 68, in __call__ for entry in self.wsgi_stack(environ, start_response): File "/py35/zope/app/wsgi/__init__.py", line 65, in __call__ request = publish(request, handle_errors=handle_errors) File "/py35/zope/publisher/publish.py", line 148, in publish response.setResult(result) File "/py35/zope/publisher/http.py", line 796, in setResult r, headers = self._implicitResult(r) File "/py35/zope/publisher/http.py", line 821, in _implicitResult if not unicode_mimetypes_re.match(ct): TypeError: expected string or bytes-like object ``` Here, `ct` is the content-type header, and its None. Returning bytes bypasses the issue. This was discovered testing with zope.app.file.
- Loading branch information