Commit daa2749
committed
Remove resurrected User.__init__ that mutated Field.validators
PR #1374 (5df8efa) fixed #1358 by deleting the User.__init__ override
that re-bound `username_field.validators[0] = UserUnicodeUsernameValidator()`
on every instantiation. The merge commit ddaddbf (resolving issue #1333,
the auth/users typing pass) carried the mypy-typed version of that same
__init__ forward and the merge-in-main resurrected it on origin/main at
0c3ce2c. The class-body declaration
`validators=[UserUnicodeUsernameValidator()]` from PR #1374 is the
canonical and only validator binding — the __init__ override was a
shared-state mutation that clobbered anything third-party prepended to
the field's validators list (and changed validator identity on each
instantiation).
The two regression tests that exposed this on main are already in the
repo and pass with this change:
- test_validators_list_stable_across_instantiations
- test_third_party_prepend_does_not_corrupt_username_validator
Also drop the now-unused `Field` import.1 parent 0c3ce2c commit daa2749
2 files changed
Lines changed: 5 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | 172 | | |
183 | 173 | | |
184 | 174 | | |
| |||
0 commit comments