Skip to content
Myr

untag without `object_hook` (#5382)

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

authored by David Lord · committed by GitHub · parents c275573, 700fc7d · Browse files · 2 files+16 added−1 removed
This commit

State

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

Diff stats

2 files+16 added−1 removed

  • other:+16 added−1 removed

2 files+16 added−1 removed

modified:src/flask/json/tag.py+13 added-1 removed
303 unmodified lines
304 return value305306 return self.tags[key].to_python(value[key])307308 def _untag_scan(self, value: t.Any) -> t.Any:309 if isinstance(value, dict):310 # untag each item recursively311 value = {k: self._untag_scan(v) for k, v in value.items()}312 # untag the dict itself313 value = self.untag(value)314 elif isinstance(value, list):315 # untag each item recursively316 value = [self._untag_scan(item) for item in value]317318 return value319320 def dumps(self, value: t.Any) -> str:321 """Tag the value and dump it to a compact JSON string."""322 return dumps(self.tag(value), separators=(",", ":"))323324 def loads(self, value: str) -> t.Any:325 """Load data from a JSON string and deserialized any tagged objects."""314 return loads(value, object_hook=self.untag)326 return self._untag_scan(loads(value))
modified:CHANGES.rst+3 added
3 unmodified lines
4Unreleased56- Correct type for ``path`` argument to ``send_file``. :issue:`5230`7- Fix a typo in an error message for the ``flask run --key`` option. :pr:`5344`8- Session data is untagged without relying on the built-in ``json.loads``9 ``object_hook``. This allows other JSON providers that don't implement that.10 :issue:`5381`111213Version 3.0.014-------------
1528 unmodified lines