Skip to content

Commit

Permalink
Fixed #12099 -- Prevented admindocs from crashing when an application…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
aaugustin committed Jan 28, 2012
1 parent dec08c3 commit 923fdd3
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions django/contrib/admindocs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,14 @@ def load_all_installed_template_libraries():
# Load/register all template tag libraries from installed apps.
for module_name in template.get_templatetags_modules():
mod = import_module(module_name)
libraries = [
os.path.splitext(p)[0]
for p in os.listdir(os.path.dirname(mod.__file__))
if p.endswith('.py') and p[0].isalpha()
]
try:
libraries = [
os.path.splitext(p)[0]
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:
try:
lib = template.get_library(library_name)
Expand Down

0 comments on commit 923fdd3

Please sign in to comment.