Skip to content
Myr

Slightly faster _tojson_filter.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by florentx · committed by florentx · parent 3c821a0 · Browse files · 1 file+9 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−10 removed

  • other:+9 added−10 removed

1 file+9 added−10 removed

modified:flask.py+9 added-10 removed
47 unmodified lines
484950# figure out if simplejson escapes slashes. This behaviour was changed51# from one version to another without reason.52if json_available:53 _json_escapes_slashes = '\\/' in json.dumps('/')52_json_escapes_slashes = json_available and '\\/' in json.dumps('/')535455class Request(RequestBase):56 """The request object used by default in flask. Remembers the
214 unmodified lines
271 except (KeyError, AttributeError):272 return os.getcwd()273274276def _tojson_filter(string, *args, **kwargs):277 """Calls dumps for the template engine, escaping Slashes properly."""278 if __debug__:279 _assert_have_json()280 rv = json.dumps(string, *args, **kwargs)281 if not _json_escapes_slashes:282 rv = rv.replace('/', '\\/')283 return rv275if not _json_escapes_slashes:276 def _tojson_filter(string, *args, **kwargs):277 """Calls dumps for the template engine, escaping slashes properly."""278 if __debug__:279 _assert_have_json()280 return json.dumps(string, *args, **kwargs).replace('/', '\\/')281else:282 _tojson_filter = json.dumps283284285class Flask(object):286 """The flask object implements a WSGI application and acts as the central
522 unmodified lines