Opened 13 years ago
Closed 12 years ago
#17650 closed Cleanup/optimization (wontfix)
BaseForm doesn't implement __contains__
Reported by: | Jaime Irurzun | Owned by: | anonymous |
---|---|---|---|
Component: | Forms | Version: | 1.4-alpha-1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
BaseForm currently implements iter and getitem, wrapping access to self.fields. It would be nice if it also implemented contains, so you could check for a name being a field of a form object.
Attachments (1)
Change History (6)
by , 13 years ago
Attachment: | baseform_contains.diff added |
---|
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
comment:2 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:3 by , 12 years ago
Owner: | changed from | to
---|
comment:4 by , 12 years ago
Type: | Uncategorized → Cleanup/optimization |
---|
comment:5 by , 12 years ago
Resolution: | → wontfix |
---|---|
Status: | assigned → closed |
No one addressed Alex' point on backwards compatibility.
Note:
See TracTickets
for help on using tickets.
Ugh, I'm actually concerned about this, because it breaks existing code. Currently
field_instance in form
works, because if__contains__
isn't defined thein
operator falls back to iterating over this, which iterates over the values of fields, rather than the keys in that dict. This behavior is different from all other mapping containers, so this requires a lot more though IMO.