[PATCH v5 3/8] settings: Resolve all but one Django 1.7 warning

Stephen Finucane stephenfinucane at hotmail.com
Wed Apr 8 07:20:50 AEST 2015


From: Stephen Finucane <stephen.finucane at intel.com>

Resolve remaining Django 1.7 warnings with the exception of a single
deprecation warning. However, this remaining issue is really a
non-issue due to the limited (and non-offending) use of the code.

Signed-off-by: Stephen Finucane <stephenfinucane at hotmail.com>
---
 apps/settings.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/apps/settings.py b/apps/settings.py
index 379fbc5..9dbac19 100644
--- a/apps/settings.py
+++ b/apps/settings.py
@@ -1,5 +1,6 @@
 # Django settings for patchwork project.
 import os
+import django
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
@@ -51,17 +52,23 @@ SECRET_KEY = '00000000000000000000000000000000000000000000000000'
 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.Loader',
     'django.template.loaders.app_directories.Loader',
-#     'django.template.loaders.eggs.load_template_source',
 )
 
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE_CLASSES = [
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     'django.middleware.doc.XViewMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
-)
+]
+
+if django.VERSION < (1, 7):
+    MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
+else:
+    MIDDLEWARE_CLASSES.append(
+        'django.contrib.admindocs.middleware.XViewMiddleware')
+    TEST_RUNNER = 'django.test.runner.DiscoverRunner'
 
 ROOT_URLCONF = 'urls'
 
-- 
2.1.0



More information about the Patchwork mailing list