Opened 14 years ago
Closed 14 years ago
#17527 closed Cleanup/optimization (fixed)
Better TypeError: m2m.add(wrong_type)
| Reported by: | Thomas Güttler | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | 1.3 |
| Severity: | Normal | Keywords: | |
| Cc: | hv@… | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
Here is a small patch, to give a better error message, if you try to add a wrong type to a many to many field.
TypeError: 'Permission' instance expected, got <FooModel abc>
Attachments (2)
Change History (6)
by , 14 years ago
| Attachment: | 17527.patch added |
|---|
comment:1 by , 14 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 14 years ago
| Attachment: | 17527-2.diff added |
|---|
comment:2 by , 14 years ago
| Needs tests: | unset |
|---|
While adding the tests, I realized there was too such similar exceptions. Mark it as RFC if you find my tests appropriate.
comment:3 by , 14 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
I applied 17527-2.diff and all unittests pass on current SVN trunk. Ready for checkin. Thank you claudep
Note:
See TracTickets
for help on using tickets.
Patch with tests