[Satosa-dev] Default value semantics
leifj at sunet.se
Fri Nov 17 03:20:07 CET 2017
On 2017-11-08 14:05, Ivan Kanakarakis wrote:
> Hello all,
> Across the satosa codebase there are places where a default behaviour
> is needed. There are two ways we signify this:
> - Using the empty string as a dictionary key
> - Using the string "default" as a dictionary key
> (where other keys define behaviour/settings for specific entities.)
> I am not sure how the project ended up with two ways to signify a
> default set, but it is annoying.
> In terms of the chosen strings to represent the default set, "" seems
> to be a valid choice, as no entity (usually entityid) should be empty.
> "default" on the other hand, is more descriptive and self documenting,
> and hopefully nobody uses that to describe and entity (or as an
> In terms of handling this, there is currently a function under
> `src/satosa/util.py` namely `get_dict_defaults()` that favours "" over
> "default" – it fallbacks to "default" if "" is not set. While this is
> fine and works, it is not used across the codebase.
> I would like this to be resolved and have a single way to signify a
> default behaviour.
> What are your opinions? Do you think this should settle to a single
> way of representing a default set, even if that means that people
> using "" or "default" will have to migrate (this would be a breaking
> change for their configs)? Which is the most appropriate way to go?
I am to blame for the function but the function encodes practice that
has been in place for a long time in satosa (so blame Roland maybe...)
and I'm not sure how practical it is to zero in on a single way to do
I agree with the need to refactor the code to use the function
everywhere so we can at least have a path to unification (perhaps via
a deprecation message) should we want to.
More information about the Satosa-dev