Support choices with differing required values in a ConditionSet.
Review Request #8349 — Created Aug. 25, 2016 and submitted — Latest diff uploaded
Previously, a
ConditionSet
's list of choices all had to accept the same
exact type of value for matches. Callers couldn't mix-and-match
different types of condition choices. If there were two pieces of data
to work with (say, a book and an author), the list of choices all had to
accept one of those, and infer the other (if possible).Now,
ConditionSet.matches()
takes keyword arguments for the values,
instead of a single positional argument for a single value. These are
compared toBaseConditionChoice.value_kwarg
for each condition being
matched.By default, choices expect a
value=
keyword argument. More advanced
usage might have some choices that takebook=
and others that take
author=
, as per the example above.
Unit tests pass.