|
|
@ -47,11 +47,6 @@ except (ImportError, AttributeError): |
|
|
|
pkg_resources = None |
|
|
|
pkg_resources = None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# figure out if simplejson escapes slashes. This behaviour was changed |
|
|
|
|
|
|
|
# from one version to another without reason. |
|
|
|
|
|
|
|
_json_escapes_slashes = json_available and '\\/' in json.dumps('/') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Request(RequestBase): |
|
|
|
class Request(RequestBase): |
|
|
|
"""The request object used by default in flask. Remembers the |
|
|
|
"""The request object used by default in flask. Remembers the |
|
|
|
matched endpoint and view arguments. |
|
|
|
matched endpoint and view arguments. |
|
|
@ -272,12 +267,13 @@ def _get_package_path(name): |
|
|
|
return os.getcwd() |
|
|
|
return os.getcwd() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not _json_escapes_slashes: |
|
|
|
# figure out if simplejson escapes slashes. This behaviour was changed |
|
|
|
def _tojson_filter(string, *args, **kwargs): |
|
|
|
# from one version to another without reason. |
|
|
|
"""Calls dumps for the template engine, escaping slashes properly.""" |
|
|
|
if not json_available or '\\/' not in json.dumps('/'): |
|
|
|
|
|
|
|
def _tojson_filter(*args, **kwargs): |
|
|
|
if __debug__: |
|
|
|
if __debug__: |
|
|
|
_assert_have_json() |
|
|
|
_assert_have_json() |
|
|
|
return json.dumps(string, *args, **kwargs).replace('/', '\\/') |
|
|
|
return json.dumps(*args, **kwargs).replace('/', '\\/') |
|
|
|
else: |
|
|
|
else: |
|
|
|
_tojson_filter = json.dumps |
|
|
|
_tojson_filter = json.dumps |
|
|
|
|
|
|
|
|
|
|
|