summaryrefslogtreecommitdiff
path: root/django/utils/module_loading.py
diff options
context:
space:
mode:
authorChris Beaven <smileychris@gmail.com>2011-08-28 02:37:16 +0000
committerChris Beaven <smileychris@gmail.com>2011-08-28 02:37:16 +0000
commit0f8f46802a172d47971a848227065894efd6a622 (patch)
tree204961c490deb21de8721d2b357a32608fb179c7 /django/utils/module_loading.py
parent77189afb7f603fc382fbb33a3a54f2b9499dc2cf (diff)
Fixed #15525 -- Custom template tags loading breaks whenever templatetags is a python file
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16703 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/module_loading.py')
-rw-r--r--django/utils/module_loading.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/utils/module_loading.py b/django/utils/module_loading.py
index 26a7e51e0d..f8aadb34df 100644
--- a/django/utils/module_loading.py
+++ b/django/utils/module_loading.py
@@ -11,10 +11,16 @@ def module_has_submodule(package, module_name):
return sys.modules[name] is not None
except KeyError:
pass
+ try:
+ package_path = package.__path__ # No __path__, then not a package.
+ except AttributeError:
+ # Since the remainder of this function assumes that we're dealing with
+ # a package (module with a __path__), so if it's not, then bail here.
+ return False
for finder in sys.meta_path:
- if finder.find_module(name, package.__path__):
+ if finder.find_module(name, package_path):
return True
- for entry in package.__path__: # No __path__, then not a package.
+ for entry in package_path:
try:
# Try the cached finder.
finder = sys.path_importer_cache[entry]