Author: russellm
Date: 2010-04-25 08:23:14 -0500 (Sun, 25 Apr 2010)
New Revision: 13024

Modified:
   django/branches/releases/1.1.X/django/utils/module_loading.py
Log:
[1.1.X] Fixed #13404 -- Reworked module_has_submodule() to allow it to work 
under AppEngine. Thanks to Waldemar Kornewald for the report and testing help.

Backport of r13023 from trunk.

Modified: django/branches/releases/1.1.X/django/utils/module_loading.py
===================================================================
--- django/branches/releases/1.1.X/django/utils/module_loading.py       
2010-04-25 13:18:24 UTC (rev 13023)
+++ django/branches/releases/1.1.X/django/utils/module_loading.py       
2010-04-25 13:23:14 UTC (rev 13024)
@@ -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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to