Opened 9 years ago
Last modified 9 years ago
#25445 closed Cleanup/optimization
`AttributeError` when `app_config` is missing attribute `models_module` in contenttypes/mananagent.py — at Initial Version
Reported by: | Clinton Christian | Owned by: | nobody |
---|---|---|---|
Component: | Uncategorized | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
`
if not app_config.models_module:
return
`
The return statement is never reached since if app_config doesn't have a models_module
attribute it raises an AttributeError.
Regardless of whether to allow the return statement to catch or return an AttributeError, this code should perhaps be changed to be more clear. I suggest either raising an AttributeError explicitly or using gettattr.
Note:
See TracTickets
for help on using tickets.