|
|
@ -92,18 +92,22 @@ class JSONDecoder(_json.JSONDecoder): |
|
|
|
|
|
|
|
|
|
|
|
def _dump_arg_defaults(kwargs): |
|
|
|
def _dump_arg_defaults(kwargs): |
|
|
|
"""Inject default arguments for dump functions.""" |
|
|
|
"""Inject default arguments for dump functions.""" |
|
|
|
kwargs.setdefault('sort_keys', True) |
|
|
|
|
|
|
|
if current_app: |
|
|
|
if current_app: |
|
|
|
kwargs.setdefault('cls', current_app.json_encoder) |
|
|
|
kwargs.setdefault('cls', current_app.json_encoder) |
|
|
|
if not current_app.config['JSON_AS_ASCII']: |
|
|
|
if not current_app.config['JSON_AS_ASCII']: |
|
|
|
kwargs.setdefault('ensure_ascii', False) |
|
|
|
kwargs.setdefault('ensure_ascii', False) |
|
|
|
kwargs.setdefault('sort_keys', current_app.config['JSON_SORT_KEYS']) |
|
|
|
kwargs.setdefault('sort_keys', current_app.config['JSON_SORT_KEYS']) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
kwargs.setdefault('sort_keys', True) |
|
|
|
|
|
|
|
kwargs.setdefault('cls', JSONEncoder) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _load_arg_defaults(kwargs): |
|
|
|
def _load_arg_defaults(kwargs): |
|
|
|
"""Inject default arguments for load functions.""" |
|
|
|
"""Inject default arguments for load functions.""" |
|
|
|
if current_app: |
|
|
|
if current_app: |
|
|
|
kwargs.setdefault('cls', current_app.json_decoder) |
|
|
|
kwargs.setdefault('cls', current_app.json_decoder) |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
kwargs.setdefault('cls', JSONDecoder) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dumps(obj, **kwargs): |
|
|
|
def dumps(obj, **kwargs): |
|
|
|