Restore behavior of JobCalculation.get_option
returning default value
#2013
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2012
Recently, the various methods to get
options
from aJobCalculation
,the historically called
get_*
methods, would return a default valueif the value was not explicitly set as an attribute. These methods were
recently replaced by the generic
get_option
method and theJobCalculation.options
dictionary, however, by default theget_option
would only return a value if explicitly set. One would have to set the
argument
only_actually_set
toFalse
to get the default value specifiedin
JobCalculation.options
, if it is defined and notNone
.The business logic however, was always calling
get_option
with defaultargument while expecting the default to be returned when not explicitly
set. In addition, certain options whose get methods used to return a
default no longer had a default defined, e.g.
append_text
.Here we properly define defaults for the options that always had one as
defined by the old explicit get methods. In addition, the default for
the
only_actually_set
forget_option
is changed toFalse
. Theinternal code in general always expects to get defaults even when not
set. Note that this required the code for
get_builder_restart
to beadapted as that expects only those options to be set that were actually
defined by the user when constructing the
JobCalculation
.