Enable nested dictionary path keys for siteconfig settings.
Review Request #12814 — Created Jan. 26, 2023 and updated
.set()now support taking a list/tuple
of strings for a path when getting or setting a value in siteconfig
settings. This is used to manipulate settings within nested
dictionaries, making it easier and safer than pulling out a dictionary
and trying to replace it.
This is supported for stored settings and registered defaults. To make
this easier to manage, there's a new
_UNSETvalue used for defaults,
and a couple helper functions to separate out stored setting retrieval
and default setting retrieval.
get()also now accepts an optional
requiredargument, which will
KeyErrorif a setting is not found in the configuration or
defaults. This can help callers distinguish actual
The management commands have been updated to take advantage of this,
simplifying that code and ensuring we have only one code path where we
update nested settings.
Upcoming changes will build on some of this work.
Unit tests passed.
Made use of the new key path support in some upcoming changes in
to make sure they worked as before.