[ckan-changes] [ckan/ckan] 09fd63: Monkey patch webob Request object
GitHub
noreply at github.com
Fri Apr 22 15:24:36 UTC 2016
Branch: refs/heads/poc-flask-views
Home: https://github.com/ckan/ckan
Commit: 09fd6300bfef0f56e7899de36eb6f32de8650a12
https://github.com/ckan/ckan/commit/09fd6300bfef0f56e7899de36eb6f32de8650a12
Author: amercader <amercadero at gmail.com>
Date: 2016-04-22 (Fri, 22 Apr 2016)
Changed paths:
M ckan/config/middleware.py
Log Message:
-----------
Monkey patch webob Request object
Sadly, a monkey-patch on the webob request object is needed because of the way
it messes with the WSGI environ.
The sympton was that Werkzeug was crashing when trying to access
`request.form` from the new Flask-based API view (this is Flask request
object). Werkzeug was throwing a ValueError when trying to parse the
WSGI environ CONTENT_TYPE value, which was `; charset="utf-8"`.
This has been going on forever (just check any stack trace from Pylons
locally or on a production site) but up until now apparently nobody needed
to use it properly.
The first option was of course trying to upgrade WebOb to see if that
fix the issues. Sadly upgrading WebOb means upgrading Pylons as well,
and that proved too much of a task.
This patch adds a small monkey patch for the
webob.request.BaseRequest._charset__set function, which essentially
wraps the original function and check the value of
environ['CONTENT_TYPE'] at the end. If it is the wrong value starting
with `;`, it sets an empty value.
Commit: e40bbff47cdb4ec558f0adc1e359c2da6bd09be5
https://github.com/ckan/ckan/commit/e40bbff47cdb4ec558f0adc1e359c2da6bd09be5
Author: amercader <amercadero at gmail.com>
Date: 2016-04-22 (Fri, 22 Apr 2016)
Changed paths:
M ckan/tests/config/test_middleware.py
M ckan/views/api.py
Log Message:
-----------
Merge branch 'poc-flask-views' of github.com:ckan/ckan into poc-flask-views
Compare: https://github.com/ckan/ckan/compare/6b27e3c1801b...e40bbff47cdb
More information about the ckan-changes
mailing list