Created attachment 589401 [details] version check on TEMPLATE_LOADERS Description of problem: Attempting to access cobbler-web results in a traceback: ImproperlyConfigured at / Error importing template source loader django.template.loaders.filesystem.Loaders.load_template_source: "No module named Loaders" Request Method: GET Request URL: http://10.0.0.8/cobbler_web/ Django Version: 1.4 Exception Type: ImproperlyConfigured Exception Value: Error importing template source loader django.template.loaders.filesystem.Loaders.load_template_source: "No module named Loaders" Exception Location: /usr/lib/python2.7/site-packages/django/template/loader.py in find_template_loader, line 97 Python Executable: /usr/bin/python Python Version: 2.7.3 Python Path: ['/usr/lib64/python27.zip', '/usr/lib64/python2.7', '/usr/lib64/python2.7/plat-linux2', '/usr/lib64/python2.7/lib-tk', '/usr/lib64/python2.7/lib-old', '/usr/lib64/python2.7/lib-dynload', '/usr/lib64/python2.7/site-packages', '/usr/lib64/python2.7/site-packages/PIL', '/usr/lib64/python2.7/site-packages/gtk-2.0', '/usr/lib/python2.7/site-packages', '/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info', '/usr/share/cobbler/web', '/usr/share/cobbler/web/cobbler_web'] Server time: Tue, 5 Jun 2012 01:52:14 -0500 Traceback Switch to copy-and-paste view /usr/lib/python2.7/site-packages/django/core/handlers/base.py in get_response response = callback(request, *callback_args, **callback_kwargs) ... ▶ Local vars /usr/share/cobbler/web/cobbler_web/views.py in index if not test_user_authenticated(request): return login(request,next="/cobbler_web") ... ▶ Local vars /usr/share/cobbler/web/cobbler_web/views.py in login return render_to_response('login.tmpl', {'next':next}) ... ▶ Local vars /usr/lib/python2.7/site-packages/django/shortcuts/__init__.py in render_to_response return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) ... ▶ Local vars /usr/lib/python2.7/site-packages/django/template/loader.py in render_to_string t = get_template(template_name) ... ▶ Local vars /usr/lib/python2.7/site-packages/django/template/loader.py in get_template template, origin = find_template(template_name) ... ▶ Local vars /usr/lib/python2.7/site-packages/django/template/loader.py in find_template loader = find_template_loader(loader_name) ... ▶ Local vars /usr/lib/python2.7/site-packages/django/template/loader.py in find_template_loader raise ImproperlyConfigured('Error importing template source loader %s: "%s"' % (loader, e)) ... ----(truncated)---- Version-Release number of selected component (if applicable): Name : Django Version : 1.4 Release : 1.fc17 Name : cobbler Version : 2.2.2 Release : 1.fc17 Name : cobbler-web Version : 2.2.2 Release : 1.fc17 How reproducible: Attempt to access a minimally configured instance of cobbler_web Actual results: Cobbler fails to load django.template.loaders.filesystem.Loaders.load_template_source Expected results: Cobbler is able to locate all required libraries. Additional info: It looks like this function was affected by a recent Django update. The attached patch incorporates the TEMPLATE_LOADERS function into a version check used for MIDDLEWARE_CLASSES, resolving the issue with this version of Django.
Upstream has already fixed this! The MIDDLEWARE_CLASSES stanza should be replaced with the following: if django.VERSION[0] == 1 and django.VERSION[1] < 2: # Legacy django had a different CSRF method, which also had # different middleware. We check the vesion here so we bring in # the correct one. MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.csrf.middleware.CsrfMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', ) else: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', )
Created attachment 589405 [details] less redundant TEMPLATE_LOADERS fix always proofread, I remind myself
This doesn't appear to be a bug in the main codebase. Looking at the release22 branch (which was just released as 2.2.3-1) with git blame shows the following for the TEMPLATE_LOADERS entry: 43a48702 django/settings.py (Michael DeHaan 2009-04-27 13:58:09 -0400 39) TEMPLATE_LOADERS = ( 43a48702 django/settings.py (Michael DeHaan 2009-04-27 13:58:09 -0400 40) 'django.template.loaders.filesystem.load_template_source', 43a48702 django/settings.py (Michael DeHaan 2009-04-27 13:58:09 -0400 41) 'django.template.loaders.app_directories.load_template_sourc 43a48702 django/settings.py (Michael DeHaan 2009-04-27 13:58:09 -0400 42) ) So that file has not changed in over 3 years. Closing this as NOTABUG.