﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25158	InvalidTemplateLibrary when using django_extensions	James Addison	nobody	"Trying to use django_extensions version 1.5.5 with Django master branch gives this traceback:

{{{
Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 1.9.dev20150721153804
Python Version: 3.4.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django_extensions']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Traceback:

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/utils.py"" in __getitem__
  86.             return self._engines[alias]

During handling of the above exception ('django'), another exception occurred:

File ""/Users/jaddison/.virtualenvs/django19test/lib/python3.4/site-packages/django_extensions/templatetags/highlighting.py"" in <module>
  41.     from pygments import highlight as pyghighlight

During handling of the above exception (No module named 'pygments'), another exception occurred:

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/backends/django.py"" in get_package_libraries
  144.             module = import_module(entry[1])

File ""/Users/jaddison/.virtualenvs/django19test/lib/python3.4/importlib/__init__.py"" in import_module
  109.     return _bootstrap._gcd_import(name[level:], package, level)

File ""/Users/jaddison/.virtualenvs/django19test/lib/python3.4/site-packages/django_extensions/templatetags/highlighting.py"" in <module>
  45.     raise ImportError(""Please install 'pygments' library to use highlighting."")

During handling of the above exception (Please install 'pygments' library to use highlighting.), another exception occurred:

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/core/handlers/base.py"" in get_response
  147.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)

File ""/Users/jaddison/projects/django19test/testviews/views.py"" in testview
  5.     return render(request, template)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/shortcuts.py"" in render
  67.             template_name, context, request=request, using=using)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/loader.py"" in render_to_string
  91.             template = get_template(template_name, using=using)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/loader.py"" in get_template
  21.     engines = _engine_list(using)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/loader.py"" in _engine_list
  139.     return engines.all() if using is None else [engines[using]]

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/utils.py"" in all
  110.         return [self[alias] for alias in self]

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/utils.py"" in <listcomp>
  110.         return [self[alias] for alias in self]

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/utils.py"" in __getitem__
  101.             engine = engine_cls(params)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/backends/django.py"" in __init__
  31.         options['libraries'] = self.get_templatetag_libraries(libraries)

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/backends/django.py"" in get_templatetag_libraries
  49.         libraries = get_installed_libraries()

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/backends/django.py"" in get_installed_libraries
  131.             for name in get_package_libraries(pkg):

File ""/Users/jaddison/.virtualenvs/django19test/src/django/django/template/backends/django.py"" in get_package_libraries
  148.                 ""trying to load '%s': %s"" % (entry[1], e)

Exception Type: InvalidTemplateLibrary at /
Exception Value: Invalid template library specified. ImportError raised when trying to load 'django_extensions.templatetags.highlighting': Please install 'pygments' library to use highlighting.
}}}

I'm not positive, but it looks like it will always blow up when a template tag 'library' is encountered that has missing Python dependencies - even if you don't use that library."	Bug	closed	Uncategorized	dev	Release blocker	invalid			Unreviewed	0	0	0	0	0	0
