Ignore attribute changes in automation trigger from/to (#7651)
* Ignore attribute changes in automation trigger from/to * Quote names in deprecation warnings This makes it somewhat easier to read if the suggestion happens to be named "to". * Add test with same state, new attribute value
This commit is contained in:
parent
adde9e6231
commit
81f0826550
3 changed files with 30 additions and 8 deletions
|
@ -23,8 +23,8 @@ def deprecated_substitute(substitute_name):
|
|||
if not warnings.get(module_name):
|
||||
logger = logging.getLogger(module_name)
|
||||
logger.warning(
|
||||
"%s is deprecated. Please rename %s to "
|
||||
"%s in '%s' to ensure future support.",
|
||||
"'%s' is deprecated. Please rename '%s' to "
|
||||
"'%s' in '%s' to ensure future support.",
|
||||
substitute_name, substitute_name, func.__name__,
|
||||
inspect.getfile(self.__class__))
|
||||
warnings[module_name] = True
|
||||
|
@ -49,7 +49,7 @@ def get_deprecated(config, new_name, old_name, default=None):
|
|||
module_name = inspect.getmodule(inspect.stack()[1][0]).__name__
|
||||
logger = logging.getLogger(module_name)
|
||||
logger.warning(
|
||||
"%s is deprecated. Please rename %s to %s in your "
|
||||
"'%s' is deprecated. Please rename '%s' to '%s' in your "
|
||||
"configuration file.", old_name, old_name, new_name)
|
||||
return config.get(old_name)
|
||||
return config.get(new_name, default)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue