Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #13404 -- Reworked module_has_submodule() to allow it to work u…

…nder AppEngine. Thanks to Waldemar Kornewald for the report and testing help.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@13023 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 9872badf33edf6b58f33e273d89365469d0139a7 1 parent d2fec79
@freakboy3742 freakboy3742 authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 django/utils/module_loading.py
View
9 django/utils/module_loading.py
@@ -2,18 +2,17 @@
import imp
def module_has_submodule(mod, submod_name):
- # If the module was loaded from an egg, __loader__ will be set and
+ # If the module was loaded from an egg, __loader__ will be set and
# its find_module must be used to search for submodules.
loader = getattr(mod, '__loader__', None)
if loader:
- mod_path = "%s.%s" % (mod.__name__, submod_name)
- mod_path = mod_path[len(loader.prefix):]
+ mod_path = "%s.%s" % (mod.__name__.rsplit('.',1)[-1], submod_name)
x = loader.find_module(mod_path)
if x is None:
# zipimport.zipimporter.find_module is documented to take
- # dotted paths but in fact through Pyton 2.7 is observed
+ # dotted paths but in fact through Python 2.7 is observed
# to require os.sep in place of dots...so try using os.sep
- # if the dotted path version failed to find the requested
+ # if the dotted path version failed to find the requested
# submodule.
x = loader.find_module(mod_path.replace('.', os.sep))
return x is not None
Please sign in to comment.
Something went wrong with that request. Please try again.