Skip to content
Myr

remove deprecated config.from_json

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

authored by David Lord · committed by David Lord · parent e21e003 · Browse files · 2 files+5 added−26 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+5 added−26 removed

  • other:+5 added−26 removed

2 files+5 added−26 removed

modified:src/flask/config.py+3 added-26 removed
174 unmodified lines
175 :meth:`from_mapping` method.176177 .. code-block:: python178179 import json180 app.config.from_file("config.json", load=json.load)181182 import toml183 app.config.from_file("config.toml", load=toml.load)184185 :param filename: The path to the data file. This can be an
20 unmodified lines
206 raise207208 return self.from_mapping(obj)209207 def from_json(self, filename: str, silent: bool = False) -> bool:208 """Update the values in the config from a JSON file. The loaded209 data is passed to the :meth:`from_mapping` method.210211 :param filename: The path to the JSON file. This can be an212 absolute path or relative to the config root path.213 :param silent: Ignore the file if it doesn't exist.214 :return: ``True`` if the file was loaded successfully.215216 .. deprecated:: 2.0.0217 Will be removed in Flask 2.1. Use :meth:`from_file` instead.218 This was removed early in 2.0.0, was added back in 2.0.1.219220 .. versionadded:: 0.11221 """222 import warnings223 from . import json224225 warnings.warn(226 "'from_json' is deprecated and will be removed in Flask"227 " 2.1. Use 'from_file(path, json.load)' instead.",228 DeprecationWarning,229 stacklevel=2,230 )231 return self.from_file(filename, json.load, silent=silent)232210 def from_mapping(211 self, mapping: t.Optional[t.Mapping[str, t.Any]] = None, **kwargs: t.Any212 ) -> bool:213 """Updates the config like :meth:`update` ignoring items with non-upper
59 unmodified lines
modified:CHANGES.rst+2 added
8 unmodified lines
9- Update Click dependency to >= 8.0. :pr:`4008`10- Remove previously deprecated code. :pr:`4337`1112 - The CLI does not pass ``script_info`` to app factory functions.13 - ``config.from_json`` is replaced by14 ``config.from_file(name, load=json.load)``.151617Version 2.0.218-------------
1180 unmodified lines