betodealmeida commented on code in PR #41286:
URL: https://github.com/apache/superset/pull/41286#discussion_r3463720335
##########
superset/views/base.py:
##########
@@ -171,20 +171,25 @@ def deprecated(
"""
def _deprecated(f: Callable[..., FlaskResponse]) -> Callable[...,
FlaskResponse]:
+ _warned = False
+
def wraps(self: BaseSupersetView, *args: Any, **kwargs: Any) ->
FlaskResponse:
- message = (
- "%s.%s "
- "This API endpoint is deprecated and will be removed in
version %s"
- )
- logger_args = [
- self.__class__.__name__,
- f.__name__,
- eol_version,
- ]
- if new_target:
- message += " . Use the following API endpoint instead: %s"
- logger_args.append(new_target)
- logger.warning(message, *logger_args)
+ nonlocal _warned
+ if not _warned:
+ _warned = True
+ message = (
+ "%s.%s "
+ "This API endpoint is deprecated and will be removed in
version %s"
+ )
+ logger_args = [
+ self.__class__.__name__,
+ f.__name__,
+ eol_version,
+ ]
+ if new_target:
+ message += " . Use the following API endpoint instead: %s"
+ logger_args.append(new_target)
+ logger.warning(message, *logger_args)
Review Comment:
This is Ok, it would result in multiple warnings but not that many compared
to today.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]