#13404 closed (fixed)
django.utils.module_loading fails if loader has no prefix attribute
Reported by: | Waldemar Kornewald | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | ||
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
In module_has_submodule() you check if a module is loaded from an egg, but if the module loader is a custom loader it might not have a prefix attribute (which is the case with App Engine's HardenedModulesHook, for example). Currently, Django raises an exception and is unusable on App Engine.
Attachments (2)
Change History (9)
by , 14 years ago
Attachment: | loader.diff added |
---|
comment:1 by , 14 years ago
Component: | Uncategorized → Core framework |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 14 years ago
@wkornewald - Just ignoring the branch if prefix doesn't exist doesn't seem quite right. The branch (in fact, the entire method) exists to ensure that we can tell the difference between import errors caused by a missing module, and import errors thrown by an existent, but buggy module. If you don't care about error reporting, you can skip the whole 'if loader' path for eggs, too -- you just don't get helpful error messages.
I've uploaded an alternate patch that avoids the need to use prefix. Can you try it out and see if it works on AppEngine?
comment:4 by , 14 years ago
Has patch: | set |
---|---|
Triage Stage: | Accepted → Ready for checkin |
Marking as RFC.
comment:5 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
possible fix? not sure if it's the best solution