fix settings to support falsy valued overrides
Up until recently there were settings with truthy defaults but with no need to be set to a false value. That changed with OIDC_INTROSPECTION_VALIDATE_AUDIENCE_SCOPE. Now there is a setting that has both a true default and a meaningful false value, and without this fix that setting cannot be changed making it not much of a setting at all.
This commit is contained in:
parent
72f123c0b5
commit
0750429992
2 changed files with 6 additions and 1 deletions
|
@ -203,7 +203,8 @@ def get(name, import_str=False):
|
|||
default_value.update(value)
|
||||
value = default_value
|
||||
else:
|
||||
value = value or default_value
|
||||
if value is None:
|
||||
value = default_value
|
||||
value = import_from_str(value) if import_str else value
|
||||
|
||||
return value
|
||||
|
|
|
@ -23,3 +23,7 @@ class SettingsTest(TestCase):
|
|||
key1 = settings.get('OIDC_UNAUTHENTICATED_SESSION_MANAGEMENT_KEY')
|
||||
key2 = settings.get('OIDC_UNAUTHENTICATED_SESSION_MANAGEMENT_KEY')
|
||||
self.assertEqual(key1, key2)
|
||||
|
||||
@override_settings(OIDC_INTROSPECTION_VALIDATE_AUDIENCE_SCOPE=False)
|
||||
def test_can_override_with_false_value(self):
|
||||
self.assertFalse(settings.get('OIDC_INTROSPECTION_VALIDATE_AUDIENCE_SCOPE'))
|
||||
|
|
Loading…
Reference in a new issue