mirror of
https://github.com/django/django.git
synced 2024-12-26 02:56:25 +00:00
Fixed #13404 -- Reworked module_has_submodule() to allow it to work under 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
This commit is contained in:
parent
d2fec79d7b
commit
9872badf33
@ -6,12 +6,11 @@ def module_has_submodule(mod, submod_name):
|
|||||||
# its find_module must be used to search for submodules.
|
# its find_module must be used to search for submodules.
|
||||||
loader = getattr(mod, '__loader__', None)
|
loader = getattr(mod, '__loader__', None)
|
||||||
if loader:
|
if loader:
|
||||||
mod_path = "%s.%s" % (mod.__name__, submod_name)
|
mod_path = "%s.%s" % (mod.__name__.rsplit('.',1)[-1], submod_name)
|
||||||
mod_path = mod_path[len(loader.prefix):]
|
|
||||||
x = loader.find_module(mod_path)
|
x = loader.find_module(mod_path)
|
||||||
if x is None:
|
if x is None:
|
||||||
# zipimport.zipimporter.find_module is documented to take
|
# 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
|
# 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.
|
# submodule.
|
||||||
|
Loading…
Reference in New Issue
Block a user