Skip to content

Proposal: Flag-based conditions for logical combinations #86

@chosak

Description

@chosak

Right now it's not easily possible to combine conditions using and/or logic, for example, enabling a flag if A and B but not (C or D). This is possible using custom conditions, but that requires writing custom code.

As a workaround, I wonder if it would work to introduce the concept of flag-based conditions, something like:

@register("flag_enabled", validator=valid_flag_name)
def flag_enabled_condition(flag_name, **kwargs):
    return flag_enabled(flag_name, **kwargs)

@register("flag_disabled", validator=valid_flag_name)
def flag_disabled_condition(flag_name, **kwargs):
    return flag_disabled(flag_name, **kwargs)

(This assumes some definition of valid_flag_name that's a regex of some kind - although in docs and by convention we tend to use SCREAMING_SNAKE_CASE, but technically are there any practical limitations on flag names? So perhaps a validator isn't even needed.)

This would allow you to define some flag FOO as C or D and then some other flag BAR as A and B and (FOO disabled).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions