mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Fix invalid key retrieval
This commit is contained in:
parent
cb6342c874
commit
7343ae7339
@ -82,9 +82,9 @@ class UserConfig(models.Model):
|
|||||||
# Iterate down the hierarchy, returning the default value if any invalid key is encountered
|
# Iterate down the hierarchy, returning the default value if any invalid key is encountered
|
||||||
try:
|
try:
|
||||||
for key in keys:
|
for key in keys:
|
||||||
d = d.get(key)
|
d = d[key]
|
||||||
return d
|
return d
|
||||||
except (AttributeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# If the key is not found in the user's config, check for an application-wide default
|
# If the key is not found in the user's config, check for an application-wide default
|
||||||
@ -92,9 +92,9 @@ class UserConfig(models.Model):
|
|||||||
d = config.DEFAULT_USER_PREFERENCES
|
d = config.DEFAULT_USER_PREFERENCES
|
||||||
try:
|
try:
|
||||||
for key in keys:
|
for key in keys:
|
||||||
d = d.get(key)
|
d = d[key]
|
||||||
return d
|
return d
|
||||||
except (AttributeError, KeyError):
|
except (TypeError, KeyError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Finally, return the specified default value (if any)
|
# Finally, return the specified default value (if any)
|
||||||
|
Loading…
Reference in New Issue
Block a user