Updated several dependencies to current version
Werkzeug update required a flask monkey patch since we can't update flask due to it depending on a newer jinja version which is backwards incompatible and hence would cause issues with third party plugins. Also added notes to the dependencies that are found to be hard to update so that future release preparations don't require to figure out the "why not" all over again.
This commit is contained in:
1 parent
4eb81aae9d
commit
4ed5f7ed28
3 files changed
+63
-32
No files matched your search
@@ -242,6 +242,7 @@ class Server(object):
|
||||
|
||||
# monkey patch a bunch of stuff
|
||||
util.tornado.fix_json_encode()
|
||||
util.flask.fix_flask_jsonify()
|
||||
util.flask.enable_additional_translations(additional_folders=[self._settings.getBaseFolder("translations")])
|
||||
|
||||
# setup app
|
||||
|
||||
@@ -251,6 +251,32 @@ def fix_flask_login_remote_address():
|
||||
|
||||
flask_login._get_remote_addr = fixed_get_remote_addr
|
||||
|
||||
def fix_flask_jsonify():
|
||||
def fixed_jsonify(*args, **kwargs):
|
||||
"""Backported from https://github.com/pallets/flask/blob/7e714bd28b6e96d82b2848b48cf8ff48b517b09b/flask/json/__init__.py#L257"""
|
||||
from flask.json import current_app, dumps
|
||||
|
||||
indent = None
|
||||
separators = (',', ':')
|
||||
|
||||
if current_app.config['JSONIFY_PRETTYPRINT_REGULAR'] or current_app.debug:
|
||||
indent = 2
|
||||
separators = (', ', ': ')
|
||||
|
||||
if args and kwargs:
|
||||
raise TypeError('jsonify() behavior undefined when passed both args and kwargs')
|
||||
elif len(args) == 1: # single args are passed directly to dumps()
|
||||
data = args[0]
|
||||
else:
|
||||
data = args or kwargs
|
||||
|
||||
return current_app.response_class(
|
||||
dumps(data, indent=indent, separators=separators) + '\n',
|
||||
mimetype='application/json'
|
||||
)
|
||||
|
||||
flask.jsonify = fixed_jsonify
|
||||
|
||||
#~~ WSGI environment wrapper for reverse proxying
|
||||
|
||||
class ReverseProxiedEnvironment(object):
|
||||
|
||||
Reference in new issue
Block a user