Fixed #12099 -- Prevented admindocs from crashing when an application that provides template tags libraries is packaged as an egg. These libraries will be ignored.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17401 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d6d4d60109
commit
f9ea619613
|
@ -307,11 +307,14 @@ def load_all_installed_template_libraries():
|
||||||
# Load/register all template tag libraries from installed apps.
|
# Load/register all template tag libraries from installed apps.
|
||||||
for module_name in template.get_templatetags_modules():
|
for module_name in template.get_templatetags_modules():
|
||||||
mod = import_module(module_name)
|
mod = import_module(module_name)
|
||||||
libraries = [
|
try:
|
||||||
os.path.splitext(p)[0]
|
libraries = [
|
||||||
for p in os.listdir(os.path.dirname(mod.__file__))
|
os.path.splitext(p)[0]
|
||||||
if p.endswith('.py') and p[0].isalpha()
|
for p in os.listdir(os.path.dirname(mod.__file__))
|
||||||
]
|
if p.endswith('.py') and p[0].isalpha()
|
||||||
|
]
|
||||||
|
except OSError:
|
||||||
|
libraries = []
|
||||||
for library_name in libraries:
|
for library_name in libraries:
|
||||||
try:
|
try:
|
||||||
lib = template.get_library(library_name)
|
lib = template.get_library(library_name)
|
||||||
|
|
Loading…
Reference in New Issue