Opened 8 years ago
Last modified 7 years ago
#29282 closed Bug
Admin Checks May Raise TypeError — at Initial Version
| Reported by: | David Sanders | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Herbert Fortes | 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
Admin checks include several calls to issubclass without a try/catch, allowing a TypeError to escape if the user provides a value that isn't a class for whatever is being checked. This seems like a sane-enough edge case to ensure the user gets a useful check failed message rather than an uncaught exception. Providing a PR that uses a helper function that catches the TypeError and returns False instead so that the half-dozen checks that use issubclass have minimal code change.
Note:
See TracTickets
for help on using tickets.