]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
trivial: Remove additional Django < 1.8 code
authorStephen Finucane <stephen@that.guru>
Sat, 7 Apr 2018 16:57:33 +0000 (17:57 +0100)
committerStephen Finucane <stephen@that.guru>
Mon, 9 Apr 2018 16:36:49 +0000 (17:36 +0100)
Yet more stuff that was missed in the previous changes.

Signed-off-by: Stephen Finucane <stephen@that.guru>
patchwork/management/commands/parsearchive.py
patchwork/management/commands/parsemail.py
patchwork/settings/dev.py
patchwork/settings/production.example.py

index f5ea4af4e113f725dc3ac33f24a5b1467a561697..16ca80f61965fea73dcd5c3c322fb693d82f0ce5 100644 (file)
@@ -19,7 +19,6 @@
 
 import logging
 import mailbox
-from optparse import make_option
 import os
 import sys
 
@@ -35,23 +34,14 @@ logger = logging.getLogger(__name__)
 class Command(BaseCommand):
     help = 'Parse an mbox archive file and store any patches/comments found.'
 
-    if django.VERSION < (1, 8):
-        args = '<infile>'
-        option_list = BaseCommand.option_list + (
-            make_option(
-                '--list-id',
-                help='mailing list ID. If not supplied, this will be '
-                'extracted from the mail headers.'),
-        )
-    else:
-        def add_arguments(self, parser):
-            parser.add_argument(
-                'infile',
-                help='input mbox filename')
-            parser.add_argument(
-                '--list-id',
-                help='mailing list ID. If not supplied, this will be '
-                'extracted from the mail headers.')
+    def add_arguments(self, parser):
+        parser.add_argument(
+            'infile',
+            help='input mbox filename')
+        parser.add_argument(
+            '--list-id',
+            help='mailing list ID. If not supplied, this will be '
+            'extracted from the mail headers.')
 
     def handle(self, *args, **options):
         results = {
index 52ec8bc568999ba4d3e421ac3476cf1eeade820d..6d9825f737f285cbf6dae4018b6e006c31171be4 100644 (file)
 
 import email
 import logging
-from optparse import make_option
 import sys
 
-import django
 from django.core.management import base
 from django.utils import six
 
@@ -34,26 +32,17 @@ logger = logging.getLogger(__name__)
 class Command(base.BaseCommand):
     help = 'Parse an mbox file and store any patch/comment found.'
 
-    if django.VERSION < (1, 8):
-        args = '<infile>'
-        option_list = base.BaseCommand.option_list + (
-            make_option(
-                '--list-id',
-                help='mailing list ID. If not supplied, this will be '
-                'extracted from the mail headers.'),
-        )
-    else:
-        def add_arguments(self, parser):
-            parser.add_argument(
-                'infile',
-                nargs='?',
-                type=str,
-                default=None,
-                help='input mbox file (a filename or stdin)')
-            parser.add_argument(
-                '--list-id',
-                help='mailing list ID. If not supplied, this will be '
-                'extracted from the mail headers.')
+    def add_arguments(self, parser):
+        parser.add_argument(
+            'infile',
+            nargs='?',
+            type=str,
+            default=None,
+            help='input mbox file (a filename or stdin)')
+        parser.add_argument(
+            '--list-id',
+            help='mailing list ID. If not supplied, this will be '
+            'extracted from the mail headers.')
 
     def handle(self, *args, **options):
         infile = args[0] if args else options['infile']
index 26d3e830985cf2cf500036dd6ddc999f0466b492..1f686f425e6ded504ebdfeb1b86598be528d2391 100644 (file)
@@ -25,11 +25,6 @@ SECRET_KEY = '00000000000000000000000000000000000000000000000000'  # noqa
 
 DEBUG = True
 
-if django.VERSION < (1, 8):
-    # In Django 1.8+, this is only necessary if the value differs from
-    # the value for 'DEBUG'
-    TEMPLATE_DEBUG = True
-
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.mysql',
@@ -38,19 +33,15 @@ DATABASES = {
         'USER': os.getenv('PW_TEST_DB_USER', 'patchwork'),
         'PASSWORD': os.getenv('PW_TEST_DB_PASS', 'password'),
         'NAME': os.getenv('PW_TEST_DB_NAME', 'patchwork'),
+        'TEST': {
+            'CHARSET': 'utf8',
+        },
     },
 }
 
 if os.getenv('PW_TEST_DB_TYPE', None) == 'postgres':
     DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
 
-if django.VERSION >= (1, 7):
-    DATABASES['default']['TEST'] = {
-        'CHARSET': 'utf8',
-    }
-else:
-    DATABASES['default']['TEST_CHARSET'] = 'utf8'
-
 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
 
 #
@@ -68,27 +59,26 @@ PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
 
 # django-debug-toolbar
 
-if django.VERSION >= (1, 8):
-    INSTALLED_APPS += [
-        'debug_toolbar'
-    ]
-
-    DEBUG_TOOLBAR_PATCH_SETTINGS = False
-
-    # This should go first in the middleware classes
-    if django.VERSION >= (1, 10):
-        MIDDLEWARE = [
-            'debug_toolbar.middleware.DebugToolbarMiddleware',
-        ] + MIDDLEWARE
-    else:
-        MIDDLEWARE_CLASSES = [
-            'debug_toolbar.middleware.DebugToolbarMiddleware',
-        ] + MIDDLEWARE_CLASSES
-
-    INTERNAL_IPS = [
-        '127.0.0.1', '::1',
-        '172.17.0.1'
-    ]
+INSTALLED_APPS += [
+    'debug_toolbar'
+]
+
+DEBUG_TOOLBAR_PATCH_SETTINGS = False
+
+# This should go first in the middleware classes
+if django.VERSION >= (1, 10):
+    MIDDLEWARE = [
+        'debug_toolbar.middleware.DebugToolbarMiddleware',
+    ] + MIDDLEWARE
+else:
+    MIDDLEWARE_CLASSES = [
+        'debug_toolbar.middleware.DebugToolbarMiddleware',
+    ] + MIDDLEWARE_CLASSES
+
+INTERNAL_IPS = [
+    '127.0.0.1', '::1',
+    '172.17.0.1'
+]
 
 
 #
index 03a0fb0a771d7169611ea24ecf679e1cf60bc01f..e97ba578b26e291c968a661aa1b261d640a16d10 100644 (file)
@@ -11,8 +11,6 @@ from __future__ import absolute_import
 
 import os
 
-import django
-
 from .base import *  # noqa
 
 #
@@ -74,6 +72,5 @@ DATABASES = {
 
 STATIC_ROOT = os.environ.get('STATIC_ROOT', '/srv/patchwork/htdocs/static')
 
-if django.VERSION >= (1, 7):
-    STATICFILES_STORAGE = \
-        'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
+STATICFILES_STORAGE = (
+    'django.contrib.staticfiles.storage.ManifestStaticFilesStorage')