|
9 | 9 | import re |
10 | 10 | import six |
11 | 11 | import sys |
| 12 | +import warnings |
12 | 13 |
|
13 | 14 | from collections import OrderedDict |
14 | 15 | from functools import wraps, partial |
@@ -219,6 +220,7 @@ def init_app(self, app, **kwargs): |
219 | 220 | else: |
220 | 221 | self.blueprint = app |
221 | 222 |
|
| 223 | + |
222 | 224 | def _init_app(self, app): |
223 | 225 | """ |
224 | 226 | Perform initialization actions with the given :class:`flask.Flask` object. |
@@ -250,6 +252,16 @@ def _init_app(self, app): |
250 | 252 | app.config.setdefault("RESTX_MASK_SWAGGER", True) |
251 | 253 | app.config.setdefault("RESTX_INCLUDE_ALL_MODELS", False) |
252 | 254 |
|
| 255 | + # check for deprecated config variable names |
| 256 | + if "ERROR_404_HELP" in app.config: |
| 257 | + app.config['RESTX_ERROR_404_HELP'] = app.config['ERROR_404_HELP'] |
| 258 | + warnings.warn( |
| 259 | + "'ERROR_404_HELP' config setting is deprecated and will be " |
| 260 | + "removed in the future. Use 'RESTX_ERROR_404_HELP' instead.", |
| 261 | + DeprecationWarning |
| 262 | + ) |
| 263 | + |
| 264 | + |
253 | 265 | def __getattr__(self, name): |
254 | 266 | try: |
255 | 267 | return getattr(self.default_namespace, name) |
@@ -709,7 +721,7 @@ def handle_error(self, e): |
709 | 721 |
|
710 | 722 | elif ( |
711 | 723 | code == HTTPStatus.NOT_FOUND |
712 | | - and current_app.config.get("ERROR_404_HELP", True) |
| 724 | + and current_app.config.get("RESTX_ERROR_404_HELP", True) |
713 | 725 | and include_message_in_response |
714 | 726 | ): |
715 | 727 | data["message"] = self._help_on_404(data.get("message", None)) |
|
0 commit comments