Reapply "Updated several dependencies to current version"
This reverts commit e14c00f135.
This commit is contained in:
1 parent
91b524813c
commit
8e464f59ac
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