[PATCH 3/4] Revert "Remove Django < 1.7 blocks"
Stephen Finucane
stephen.finucane at intel.com
Mon Nov 9 13:29:15 AEDT 2015
This reverts commit ea050ad02c61ff1f0bd03ffb02b4706817401aee.
To allow patchwork deployment on Enterpise versions of Linux, it is
necessary to continue to support Django 1.6.
---
patchwork/settings/base.py | 7 +++++--
patchwork/settings/dev.py | 9 ++++++---
patchwork/settings/production.example.py | 1 +
patchwork/tests/browser.py | 5 ++++-
4 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index 82c792c..ae93622 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -37,8 +37,11 @@ MIDDLEWARE_CLASSES = [
'django.middleware.csrf.CsrfViewMiddleware',
]
-MIDDLEWARE_CLASSES.append(
- 'django.contrib.admindocs.middleware.XViewMiddleware')
+if django.VERSION < (1, 7):
+ MIDDLEWARE_CLASSES.append('django.middleware.doc.XViewMiddleware')
+else:
+ MIDDLEWARE_CLASSES.append(
+ 'django.contrib.admindocs.middleware.XViewMiddleware')
# Globalization
diff --git a/patchwork/settings/dev.py b/patchwork/settings/dev.py
index 62dfe2e..e93249c 100644
--- a/patchwork/settings/dev.py
+++ b/patchwork/settings/dev.py
@@ -41,9 +41,12 @@ DATABASES = {
},
}
-DATABASES['default']['TEST'] = {
- 'CHARSET': 'utf8',
-}
+if django.VERSION < (1, 7):
+ DATABASES['default']['TEST_CHARSET'] = 'utf8'
+else:
+ DATABASES['default']['TEST'] = {
+ 'CHARSET': 'utf8',
+ }
#
# Patchwork settings
diff --git a/patchwork/settings/production.example.py b/patchwork/settings/production.example.py
index 41d6284..9cf6712 100644
--- a/patchwork/settings/production.example.py
+++ b/patchwork/settings/production.example.py
@@ -56,3 +56,4 @@ DATABASES = {
#
STATIC_ROOT = '/srv/patchwork/htdocs/static'
+
diff --git a/patchwork/tests/browser.py b/patchwork/tests/browser.py
index 0af5693..80285db 100644
--- a/patchwork/tests/browser.py
+++ b/patchwork/tests/browser.py
@@ -21,7 +21,10 @@ import errno
import os
import time
-from django.contrib.staticfiles.testing import StaticLiveServerTestCase
+try: # django 1.7+
+ from django.contrib.staticfiles.testing import StaticLiveServerTestCase
+except:
+ from django.test import LiveServerTestCase as StaticLiveServerTestCase
from selenium.common.exceptions import (
NoSuchElementException, StaleElementReferenceException,
TimeoutException)
--
2.0.0
More information about the Patchwork
mailing list