Support ConditionChoices instances in ConditionsField and add typing.

Review Request #14272 — Created Dec. 15, 2024 and submitted

Information

Djblets
release-5.x

Reviewers

ConditionsField claimed support for taking a ConditionChoices class
or a callable returning the class, but not an instance. We have call
sites that passed in a class accordingly. The problem with prioritizing
classes is that there's no ability for code to register choices into a
ConditionChoices after construction (say, for extensions).

In practice, this field supported instances just fine, and we even had
unit tests for it, but we now document this explicitly (fixing class
names in the process).

The field has also been updated with typing, signature matches, and
some code cleanup.

Unit tests pass.

Summary ID
Support ConditionChoices instances in ConditionsField and add typing.
`ConditionsField` claimed support for taking a `ConditionChoices` class or a callable returning the class, but not an instance. We have call sites that passed in a class accordingly. The problem with prioritizing classes is that there's no ability for code to register choices into a `ConditionChoices` after construction (say, for extensions). In practice, this field supported instances just fine, and we even had unit tests for it, but we now document this explicitly (fixing class names in the process). The field has also been updated with typing and some code cleanup.
70b5cdd72f026a26370b60c2b005241b15480795
Description From Last Updated

It says "may not" here when it should only say "may".

maubinmaubin

Mind fixing this typo while you're here?

daviddavid
There are no open issues
chipx86
maubin
  1. 
      
  2. djblets/forms/fields.py (Diff revision 1)
     
     
    Show all issues

    It says "may not" here when it should only say "may".

    1. It was supposed to be "may now." Good catch!

  3. 
      
chipx86
maubin
  1. Ship It!
  2. 
      
david
  1. 
      
  2. djblets/forms/fields.py (Diff revision 2)
     
     
    Show all issues

    Mind fixing this typo while you're here?

  3. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (5878b61)
Loading...