mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Fix AttributeError when optional settings are undefined
Fixes #1328 - Add None as default value in axes_conf_check - Add test coverage for missing settings scenario
This commit is contained in:
parent
f2af7c993b
commit
95a8043341
2 changed files with 6 additions and 1 deletions
|
|
@ -207,7 +207,7 @@ def axes_conf_check(app_configs, **kwargs): # pylint: disable=unused-argument
|
|||
]
|
||||
|
||||
for callable_setting in callable_settings:
|
||||
value = getattr(settings, callable_setting)
|
||||
value = getattr(settings, callable_setting, None)
|
||||
if not is_valid_callable(value):
|
||||
warnings.append(
|
||||
Warning(
|
||||
|
|
|
|||
|
|
@ -129,3 +129,8 @@ class ConfCheckTestCase(AxesTestCase):
|
|||
def test_valid_callable(self):
|
||||
warnings = run_checks()
|
||||
self.assertEqual(warnings, [])
|
||||
|
||||
def test_missing_settings_no_error(self):
|
||||
warnings = run_checks()
|
||||
self.assertEqual(warnings, [])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue