]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Remove support for Django 1.6, 1.7
authorStephen Finucane <stephen@that.guru>
Fri, 24 Nov 2017 19:37:42 +0000 (19:37 +0000)
committerStephen Finucane <stephen@that.guru>
Thu, 4 Jan 2018 14:19:39 +0000 (14:19 +0000)
These versions are massively outdated and the only reason for keeping
them was to allow installation on RHEL 7 using the version provided via
EPEL. No one's actually using this so just kill it.

This also allows us to remove support for django-filter 0.11, which was
only retained for use with these older versions of Django.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Reviewed-by: Daniel Axtens <dja@axtens.net>
17 files changed:
README.rst
docs/deployment/upgrading.rst
docs/development/installation.rst
patchwork/api/cover.py
patchwork/api/filters.py
patchwork/api/patch.py
patchwork/compat.py
patchwork/models.py
patchwork/notifications.py
patchwork/templates/patchwork/patch-list.html
patchwork/templates/patchwork/projects.html
patchwork/templatetags/compat.py [deleted file]
patchwork/tests/browser.py
patchwork/views/mail.py
patchwork/views/user.py
releasenotes/notes/remove-django-1-6-and-1-7-support-7f77e45668c39aae.yaml [new file with mode: 0644]
tox.ini

index f55940c9762955f3da4e76e05aa66ba8e8422f23..f8f44ab499fc0791be1281ee734b82bbd8c5a46e 100644 (file)
@@ -43,11 +43,11 @@ Requirements
 
 - Python (2.7, 3.3 - 3.5)
 
-- Django (1.6 - 1.11)
+- Django (1.8 - 1.11)
 
 - Django REST Framework (3.2 - 3.6)
 
-- Django Filters (0.11 - 1.0)
+- Django Filters (1.0)
 
 Development Installation
 ------------------------
index 2c2766c5865736782f152a1d48ca7cae6a7e11ff..d368509dc1710bcefd60abf238a4cc994d11c5eb 100644 (file)
@@ -59,94 +59,14 @@ management commands:
 Upgrade Your Database
 ---------------------
 
-Migrations of the database can be tricky. Prior to `v1.0.0`__, database
-migrations were provided by way of manual, SQL migration scripts. After this
-release, Patchwork moved to support `Django migrations`__.  If you are
-upgrading from `v1.0.0` or later, it is likely that you can rely entirely on
-the later to bring your database up-to-date. This can be done like so:
+New versions of Patchwork may provide a number of schema and/or data migrations
+which must be applied before starting the instance. To do this, run the
+*migrate* management command:
 
 .. code-block:: shell
 
    $ ./manage.py migrate
 
-However, there are a number of scenarios in which you may need to fall back to
-the provided SQL migrations or provide your own:
+For more information on migrations, refer to `the Django documentation`__.
 
-* You are using Django < 1.6
-
-  Patchwork supports Django 1.6. However, Django Migrations was added in 1.7
-  and is `not available for previous versions`__. As such, you must continue to
-  use manual migrations or upgrade your version of Django. For many of the
-  migrations, this can be done automatically:
-
-  .. code-block:: shell
-
-     $ ./manage.py sqlmigrate patchwork 0003_add_check_model
-
-  However, this only works for schema migrations. For data migrations,
-  however, this will fail. In this cases, these migrations will need to be
-  handwritten.
-
-* You are using Django > 1.6, but upgrading from Patchwork < 1.0.0
-
-  Patchwork only started providing migrations in `v1.0.0`. SQL migrations are
-  provided for versions prior to this and must be applied to get the database
-  to the "initial" state that Django migrations expects.
-
-* You have diverged from upstream Patchwork
-
-  If you have applied custom patches that change the database models, the
-  database in an "inconsistent state" and the provided migrations will likely
-  fail to apply.
-
-Steps to handle the latter two of these are described below.
-
-__ https://github.com/getpatchwork/patchwork/releases/tag/v1.0.0
-__ https://docs.djangoproject.com/en/1.8/topics/migrations/
-__ http://blog.allenap.me/2015/05/south-south-2-and-django-migrations.html
-
-Upgrading a pre-v1.0.0 Patchwork instance
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-The process for this type of upgrade is quite simple: upgrade using manual SQL
-upgrades until better options become available. As such, you should apply all
-unapplied SQL migrations that are not duplicated by Django migrations.  Once
-such duplication occurs, rely on the Django migrations only and continue to do
-so going forward.
-
-Upgrading a "diverged" Patchwork instance
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-This type of upgrade is a little trickier. There are two options you can take:
-
-1. Bring your Patchwork instance back in sync with upstream
-
-2. Provide your own migrations
-
-The former option is particularly suitable if you decide to upstream your
-change or decide it's not valuable enough to retain. This will require either
-reworking any migrations that exist prior to your feature being upstreamed, or
-deleting any added database fields and tables, respectively. In both cases,
-manually, hand-written SQL migrations will be required to get the databse into
-a consistent state (remember: **backup**!). Once this is done, you can resume
-using the upstream-provided migrations, ensuring any Django migrations that you
-may have skipped are not applied again:
-
-.. code-block:: shell
-
-   $ ./manage.py migrate 000x-abc --fake  # when 000x-abc is last "skippable"
-
-It's worth adding that with the databases now back in sync it should be
-possible to return to using upstream code rather than maintaining a fork.
-
-The latter option is best chosen if you wish to retain the aforementioned fork.
-How you do this depends on the extensiveness of your changes, but getting the
-latest version of Patchwork, deleting the provided migrations, applying any
-patches you may have and regenerating the migrations seems like the best
-option.
-
-.. note::
-
-   To prevent the latter case above from occurring, we'd ask that you submit
-   any patches you may have to the upstream Patchwork so that the wider
-   community can benefit from this new functionality.
+__ https://docs.djangoproject.com/en/1.11/topics/migrations/
index 70d3145f1b6060f0dbb67002fef0d0e0e990f873..30fdb547a45668be8a67e4fe62718180013d4b83 100644 (file)
@@ -70,7 +70,7 @@ To run specific tox targets or tests, pass arguments to the above:
 
 .. code-block:: shell
 
-   $ docker-compose run --rm web --quick-tox -e py27-django17 \
+   $ docker-compose run --rm web --quick-tox -e py27-django18 \
        patchwork.tests.test_bundles
 
 To run all tests, including Selenium UI interaction tests, using only the
index 2a7651f488aef75f2b4f3519485ff21ae393a174..10645048aaac51affd1e6d1393fd51382a5db48f 100644 (file)
@@ -19,7 +19,6 @@
 
 import email.parser
 
-import django
 from rest_framework.generics import ListAPIView
 from rest_framework.generics import RetrieveAPIView
 from rest_framework.serializers import HyperlinkedModelSerializer
@@ -78,15 +77,9 @@ class CoverLetterList(ListAPIView):
     ordering = 'id'
 
     def get_queryset(self):
-        qs = CoverLetter.objects.all().prefetch_related('series')\
-            .select_related('project', 'submitter')
-
-        # FIXME(stephenfin): This causes issues with Django 1.6 for whatever
-        # reason. Suffer the performance hit on those versions.
-        if django.VERSION >= (1, 7):
-            qs.defer('content', 'headers')
-
-        return qs
+        return CoverLetter.objects.all().prefetch_related('series')\
+            .select_related('project', 'submitter')\
+            .defer('content', 'headers')
 
 
 class CoverLetterDetail(RetrieveAPIView):
index 198d64f4d7999fdac80969d38a31676998f77f27..15dff5fd58fc8cc5c4879f20ac0fc63c8dc427e0 100644 (file)
@@ -23,7 +23,6 @@ from django_filters import IsoDateTimeFilter
 from django_filters import ModelChoiceFilter
 from django.forms import ModelChoiceField
 
-from patchwork.compat import LOOKUP_FIELD
 from patchwork.models import Bundle
 from patchwork.models import Check
 from patchwork.models import CoverLetter
@@ -37,8 +36,8 @@ from patchwork.models import State
 class TimestampMixin(FilterSet):
 
     # TODO(stephenfin): These should filter on a 'updated_at' field instead
-    before = IsoDateTimeFilter(name='date', **{LOOKUP_FIELD: 'lt'})
-    since = IsoDateTimeFilter(name='date', **{LOOKUP_FIELD: 'gte'})
+    before = IsoDateTimeFilter(name='date', lookup_expr='lt')
+    since = IsoDateTimeFilter(name='date', lookup_expr='gte')
 
 
 class ProjectChoiceField(ModelChoiceField):
index cb829c7db5d74228d41da8dadc7f579f8aa2fe15..1922cf5b8e41ea088c85374dbe85de4f1e8ebbf1 100644 (file)
@@ -57,7 +57,6 @@ class StateField(RelatedField):
         'incorrect_type': _('Incorrect type. Expected string value, received '
                             '{data_type}.'),
     }
-    queryset = ''  # django 1.6, rest_framework 3.2 require this
 
     def to_internal_value(self, data):
         try:
@@ -151,8 +150,6 @@ class PatchList(ListAPIView):
     ordering = 'id'
 
     def get_queryset(self):
-        # TODO(stephenfin): Does the defer here cause issues with Django 1.6
-        # (like /cover)?
         return Patch.objects.all()\
             .prefetch_related('series', 'check_set')\
             .select_related('project', 'state', 'submitter', 'delegate')\
index 177e79e3d6e3861a1639c2d476861e6e9e337050..38caa4e861cf0e43f6f3677771bc4ed639a94973 100644 (file)
@@ -23,25 +23,6 @@ import django
 from django.conf import settings
 
 
-# render_to_string
-#
-# The render_to_string function no longer accepts the dictionary and
-# context_instance parameters in Django 1.10.
-#
-# https://docs.djangoproject.com/en/dev/releases/1.8/
-
-if django.VERSION >= (1, 8):
-    from django.template.loader import render_to_string  # noqa
-else:
-    from django.template import loader  # noqa
-    from django.template import RequestContext  # noqa
-
-    def render_to_string(template_name, context=None, request=None):
-        context_instance = RequestContext(request) if request else None
-        return loader.render_to_string(template_name, context,
-                                       context_instance)
-
-
 # DjangoFilterBackend
 #
 # The DjangoFilterBackend was provided in Django REST Framework from 3.0 to
@@ -60,24 +41,6 @@ if settings.ENABLE_REST_API:
         from rest_framework.filters import DjangoFilterBackend  # noqa
 
 
-# LOOKUP_FIELD
-#
-# The django-filter library uses the 'lookup_expr' attribute to determine which
-# lookup type to use, e.g. exact, gt, lt etc. However, until 0.13 this was
-# called 'lookup_type', and 0.13 supported both but gave a deprecation warning.
-# We need to support these versions for use with older versions of DRF.
-#
-# https://github.com/carltongibson/django-filter/blob/v0.13/django_filters\
-#   /filters.py#L35-L36
-if settings.ENABLE_REST_API:
-    import django_filters  # noqa
-
-    if django_filters.VERSION >= (1, 0):
-        LOOKUP_FIELD = 'lookup_expr'
-    else:
-        LOOKUP_FIELD = 'lookup_type'
-
-
 # reverse, reverse_lazy
 #
 # The reverse and reverse_lazy functions have been moved to django.urls in
index b746588ea38bb519274d12ee7176bac08740bbc2..11886f1a73a5719e36ad4fca034a1f83b5034c2f 100644 (file)
@@ -575,12 +575,8 @@ class Comment(EmailMixin, models.Model):
 
     def save(self, *args, **kwargs):
         super(Comment, self).save(*args, **kwargs)
-        # NOTE(stephenfin): Mitigate an issue with Python 3.4 + Django 1.6
-        try:
-            if hasattr(self.submission, 'patch'):
-                self.submission.patch.refresh_tag_counts()
-        except Patch.DoesNotExist:
-            pass
+        if hasattr(self.submission, 'patch'):
+            self.submission.patch.refresh_tag_counts()
 
     def delete(self, *args, **kwargs):
         super(Comment, self).delete(*args, **kwargs)
@@ -997,8 +993,3 @@ class PatchChangeNotification(models.Model):
                                  on_delete=models.CASCADE)
     last_modified = models.DateTimeField(default=datetime.datetime.now)
     orig_state = models.ForeignKey(State, on_delete=models.CASCADE)
-
-
-if django.VERSION < (1, 7):
-    # We don't have support for AppConfig in Django 1.6.x
-    import patchwork.signals  # noqa
index 840d2cf915dd3fe8e25bfe051e22e13a947e7439..88e96628e294482f59f294289182a97b93b8fc16 100644 (file)
@@ -27,8 +27,8 @@ from django.contrib.sites.models import Site
 from django.core.mail import EmailMessage
 from django.db.models import Count
 from django.db.models import Q
+from django.template.loader import render_to_string
 
-from patchwork.compat import render_to_string
 from patchwork.models import EmailConfirmation
 from patchwork.models import EmailOptout
 from patchwork.models import PatchChangeNotification
index c645ec855572bc37397c302fceddce008bd3cfbb..71c1ba927d1b4cdd72c4a23b2e8448bf9ba93ac6 100644 (file)
@@ -4,8 +4,6 @@
 {% load project %}
 {% load static %}
 
-{% load cycle from compat %}
-
 {% include "patchwork/filters.html" %}
 
 {% include "patchwork/pagination.html" %}
index d75077d499c492a656fed6b3e86d9b24cee8a63a..9ce1918caad6c83bf9dc6a2f24632f6a4587ae10 100644 (file)
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
-{% load cycle from compat %}
 
 {% block title %}Project List{% endblock %}
 {% block body %}
diff --git a/patchwork/templatetags/compat.py b/patchwork/templatetags/compat.py
deleted file mode 100644 (file)
index 7b210e8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Patchwork - automated patch tracking system
-# Copyright (C) 2016 Stephen Finucane <stephen@that.guru>
-#
-# This file is part of the Patchwork package.
-#
-# Patchwork is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# Patchwork is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Patchwork; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-"""Compatibility wrappers for various Django versions."""
-
-import django
-from django.template import defaulttags
-from django.template import Library
-
-
-register = Library()
-
-
-# cycle
-#
-# The cycle template tag enables auto-escaping by default in 1.8, with
-# deprecations enabled in 1.7. A 'future' library is provided in 1.6
-# to mitigate this, but it is removed in 1.10. Provide our own version
-# of 'future' to ensure this works in all versions of Django supported.
-#
-# https://docs.djangoproject.com/en/dev/releases/1.6/
-# https://docs.djangoproject.com/en/dev/releases/1.10/
-
-@register.tag
-def cycle(parser, token):
-    if django.VERSION < (1, 8):
-        return defaulttags.cycle(parser, token, escape=True)
-    else:
-        return defaulttags.cycle(parser, token)
index 3ea3266b8f4f40e29ec4784e135be5851cce6440..1939defbe8078d21540ea454af9638c2857996e3 100644 (file)
@@ -21,10 +21,7 @@ import errno
 import os
 import time
 
-try:
-    from django.contrib.staticfiles.testing import StaticLiveServerTestCase
-except:  # Django < 1.7
-    from django.test import LiveServerTestCase as StaticLiveServerTestCase
+from django.contrib.staticfiles.testing import StaticLiveServerTestCase
 from selenium.common.exceptions import (
     NoSuchElementException, StaleElementReferenceException,
     TimeoutException)
index 49c7972717a9a05517fb316a3ee03921b663d376..8afd83b3d7be7125e2b02ebdeec393b523deca1f 100644 (file)
@@ -23,8 +23,8 @@ from django.conf import settings as conf_settings
 from django.core.mail import send_mail
 from django.http import HttpResponseRedirect
 from django.shortcuts import render
+from django.template.loader import render_to_string
 
-from patchwork.compat import render_to_string
 from patchwork.compat import reverse
 from patchwork.forms import EmailForm
 from patchwork.models import EmailConfirmation
index 693c02da22dec87db6268a74d6f3ac5f375fd136..79c615aa2da0461940852a15ea8f5c00af348233 100644 (file)
@@ -27,8 +27,8 @@ from django.core.mail import send_mail
 from django.http import HttpResponseRedirect
 from django.shortcuts import get_object_or_404
 from django.shortcuts import render
+from django.template.loader import render_to_string
 
-from patchwork.compat import render_to_string
 from patchwork.compat import reverse
 from patchwork.filters import DelegateFilter
 from patchwork.forms import EmailForm
diff --git a/releasenotes/notes/remove-django-1-6-and-1-7-support-7f77e45668c39aae.yaml b/releasenotes/notes/remove-django-1-6-and-1-7-support-7f77e45668c39aae.yaml
new file mode 100644 (file)
index 0000000..ca9d9d1
--- /dev/null
@@ -0,0 +1,8 @@
+---
+upgrade:
+  - |
+    Django 1.6 and 1.7 are no longer supported. These are no longer supported
+    upstream and most distributions provide a newer version.
+  - |
+    django-filter 0.11 is no longer supported. This was only used with Django
+    1.6 and 1.7 and is not compatible with any version supported by Patchwork.
diff --git a/tox.ini b/tox.ini
index 976789ea4e083a820b0286af77f096bf4d5abe73..bd8af76729cccbe3a62e9524f958383872000a37 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,17 +1,11 @@
 [tox]
 minversion = 2.0
-envlist = pep8,py{27,34}-django{16,17,18,19,110,111},py35-django{18,19,110,111}
+envlist = pep8,py{27,34,35}-django{18,19,110,111}
 skipsdist = True
 
 [testenv]
 deps =
     -r{toxinidir}/requirements-test.txt
-    django16: django>=1.6,<1.7
-    django16: djangorestframework>=3.2,<3.3
-    django16: django-filter>=0.11,<0.12
-    django17: django>=1.7,<1.8
-    django17: djangorestframework>=3.3,<3.4
-    django17: django-filter>=0.11,<0.12
     django18: django>=1.8,<1.9
     django19: django>=1.9,<1.10
     django110: django>=1.10,<1.11