mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Improve check for deprecated flags
Checking with getattr(object, name, [default]) provides false positivies for flags that have their value set to None. Checking with try: getattr(object, name) always produces correct check values if a flag is defined in project settings. Default values for flags are defined in the Axes default settings so this should not alter any existing behaviour.
This commit is contained in:
parent
dfcc63b2cd
commit
5107e8df37
1 changed files with 4 additions and 1 deletions
|
|
@ -99,11 +99,14 @@ def axes_deprecation_check(app_configs, **kwargs): # pylint: disable=unused-arg
|
|||
]
|
||||
|
||||
for deprecated_setting in deprecated_settings:
|
||||
if getattr(settings, deprecated_setting, None) is not None:
|
||||
try:
|
||||
getattr(settings, deprecated_setting)
|
||||
warnings.append(Warning(
|
||||
msg=Messages.SETTING_DEPRECATED.format(deprecated_setting=deprecated_setting),
|
||||
hint=None,
|
||||
id=Codes.SETTING_DEPRECATED,
|
||||
))
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return warnings
|
||||
|
|
|
|||
Loading…
Reference in a new issue