Opened 19 years ago

Closed 18 years ago

Last modified 18 years ago

#1697 closed enhancement (fixed)

[patch] magic-removal: the choices keyword for Fields is restricted

Reported by: brantley Owned by: Adrian Holovaty
Component: Core (Other) Version: magic-removal
Severity: normal Keywords: validate choices
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The choices keyword is restricted to a list or tuple by the management.py, get_validation_errors(). It should instead allow anything that is iterable. For instance, a generator could then be used. I've attached a simple patch.

Attachments (1)

iterable.diff (849 bytes ) - added by brantley 19 years ago.
patch

Download all attachments as: .zip

Change History (4)

by brantley, 19 years ago

Attachment: iterable.diff added

patch

comment:1 by Christopher Lenz <cmlenz@…>, 19 years ago

Note that (I think) this will also allow strings, which will result in a different behavior than the developer would probably expect.

comment:2 by brantley, 19 years ago

Yes, it would be allowed by the validation, but would not work as the system will expect two-tuples. But I'm not sure if validate should check each item of the iterable or what.

comment:3 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [3094]) Fixed #1697 and #2095 -- Made 'choices' parameter accept any iterable

Note: See TracTickets for help on using tickets.
Back to Top