Skip to content
Myr

Merge pull request #4081 from pallets/config-json

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

re-add deprecated `Config.from_json` method

authored by David Lord · committed by GitHub · parents b5518e2, 10425fb · Browse files · 2 files+27 added−0 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+27 added−0 removed

  • other:+27 added−0 removed

2 files+27 added−0 removed

modified:src/flask/config.py+25 added
200 unmodified lines
201 raise202203 return self.from_mapping(obj)204205 def from_json(self, filename: str, silent: bool = False) -> bool:206 """Update the values in the config from a JSON file. The loaded207 data is passed to the :meth:`from_mapping` method.208209 :param filename: The path to the JSON file. This can be an210 absolute path or relative to the config root path.211 :param silent: Ignore the file if it doesn't exist.212213 .. deprecated:: 2.0.0214 Will be removed in Flask 2.1. Use :meth:`from_file` instead.215 This was removed early in 2.0.0, was added back in 2.0.1.216217 .. versionadded:: 0.11218 """219 import warnings220 from . import json221222 warnings.warn(223 "'from_json' is deprecated and will be removed in Flask"224 " 2.1. Use 'from_file(path, json.load)' instead.",225 DeprecationWarning,226 stacklevel=2,227 )228 return self.from_file(filename, json.load, silent=silent)229230 def from_mapping(231 self, mapping: t.Optional[t.Mapping[str, t.Any]] = None, **kwargs: t.Any232 ) -> bool:233 """Updates the config like :meth:`update` ignoring items with non-upper
58 unmodified lines
modified:CHANGES.rst+2 added
21 unmodified lines
22 a ``url_prefix`` value. :issue:`4037`23- Roll back a change to the order that URL matching was done. The24 URL is again matched after the session is loaded, so the session is25 available in custom URL converters. :issue:`4053`26- Re-add deprecated ``Config.from_json``, which was accidentally27 removed early. :issue:`4078`282930Version 2.0.031-------------
1116 unmodified lines