#11859 closed (fixed)
Change type checking condition in validation of choices
| Reported by: | paluh | Owned by: | nobody | 
|---|---|---|---|
| Component: | Core (Other) | Version: | dev | 
| Severity: | Keywords: | model, validation, choices | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
I want to use instance of tuple subclass (instead of tuple instance) in IntegerField choices initialization. It's impossible because in core/management/validation.py (line 62) there is condition:
if not type(c) in (tuple, list) or len(c) != 2:
Can it be changed to:
if not (isinstance(c, tuple) or isinstance(c, list)) or len(c) != 2:
Attachments (2)
Change History (8)
by , 16 years ago
| Attachment: | validation.diff added | 
|---|
comment:1 by , 16 years ago
| milestone: | → 1.2 | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:2 by , 16 years ago
by , 16 years ago
| Attachment: | t11859.diff added | 
|---|
comment:3 by , 16 years ago
| Triage Stage: | Accepted → Ready for checkin | 
|---|
comment:4 by , 16 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
comment:5 by , 16 years ago
  Note:
 See   TracTickets
 for help on using tickets.
    
Surely you mean
isinstance(c, (list, tuple));)