[PATCH 05/11] Remove compat wrapper for Django < 1.11
Stephen Finucane
stephen at that.guru
Mon Jun 25 05:55:51 AEST 2018
Deleting code is fun. We no longer need to carry these so don't.
Signed-off-by: Stephen Finucane <stephen at that.guru>
---
patchwork/api/bundle.py | 3 +-
patchwork/compat.py | 50 +--------------------------
patchwork/models.py | 7 ++--
patchwork/paginator.py | 4 +--
patchwork/settings/base.py | 2 +-
patchwork/templatetags/listurl.py | 4 +--
patchwork/templatetags/person.py | 2 +-
patchwork/tests/api/test_bundle.py | 2 +-
patchwork/tests/api/test_check.py | 2 +-
patchwork/tests/api/test_comment.py | 4 +--
patchwork/tests/api/test_cover.py | 2 +-
patchwork/tests/api/test_patch.py | 2 +-
patchwork/tests/api/test_person.py | 2 +-
patchwork/tests/api/test_project.py | 2 +-
patchwork/tests/api/test_series.py | 2 +-
patchwork/tests/api/test_user.py | 2 +-
patchwork/tests/test_about.py | 3 +-
patchwork/tests/test_bundles.py | 2 +-
patchwork/tests/test_completion.py | 2 +-
patchwork/tests/test_confirm.py | 2 +-
patchwork/tests/test_detail.py | 2 +-
patchwork/tests/test_encodings.py | 2 +-
patchwork/tests/test_filters.py | 2 +-
patchwork/tests/test_list.py | 2 +-
patchwork/tests/test_mail_settings.py | 2 +-
patchwork/tests/test_mboxviews.py | 2 +-
patchwork/tests/test_paginator.py | 2 +-
patchwork/tests/test_projects.py | 2 +-
patchwork/tests/test_registration.py | 2 +-
patchwork/tests/test_updates.py | 2 +-
patchwork/tests/test_user.py | 2 +-
patchwork/tests/test_xmlrpc.py | 2 +-
patchwork/urls.py | 2 +-
patchwork/views/__init__.py | 3 +-
patchwork/views/about.py | 3 +-
patchwork/views/bundle.py | 2 +-
patchwork/views/comment.py | 2 +-
patchwork/views/cover.py | 2 +-
patchwork/views/mail.py | 2 +-
patchwork/views/patch.py | 9 +++--
patchwork/views/project.py | 2 +-
patchwork/views/user.py | 2 +-
patchwork/views/xmlrpc.py | 2 +-
43 files changed, 50 insertions(+), 106 deletions(-)
diff --git a/patchwork/api/bundle.py b/patchwork/api/bundle.py
index b0005daa..7b147e1d 100644
--- a/patchwork/api/bundle.py
+++ b/patchwork/api/bundle.py
@@ -28,7 +28,6 @@ from patchwork.api.filters import BundleFilterSet
from patchwork.api.embedded import PatchSerializer
from patchwork.api.embedded import ProjectSerializer
from patchwork.api.embedded import UserSerializer
-from patchwork.compat import is_authenticated
from patchwork.models import Bundle
@@ -67,7 +66,7 @@ class BundleMixin(object):
serializer_class = BundleSerializer
def get_queryset(self):
- if is_authenticated(self.request.user):
+ if self.request.user.is_authenticated:
bundle_filter = Q(owner=self.request.user) | Q(public=True)
else:
bundle_filter = Q(public=True)
diff --git a/patchwork/compat.py b/patchwork/compat.py
index e74e9264..9383143c 100644
--- a/patchwork/compat.py
+++ b/patchwork/compat.py
@@ -17,30 +17,11 @@
# 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."""
+"""Compatibility wrappers for various library versions."""
-import django
from django.conf import settings
-# DjangoFilterBackend
-#
-# The DjangoFilterBackend was provided in Django REST Framework from 3.0 to
-# 3.4, was marked as pending deprecation in 3.5, was deprecated in 3.6 and will
-# be removed in 3.7. However, the equivalent DjangoFilterBackend found in
-# django-filter is only available since 1.0 of that package.
-#
-# http://www.django-rest-framework.org/topics/3.6-announcement/
-
-if settings.ENABLE_REST_API:
- import rest_framework # noqa
-
- if rest_framework.VERSION >= '3.5':
- from django_filters.rest_framework import DjangoFilterBackend # noqa
- else:
- from rest_framework.filters import DjangoFilterBackend # noqa
-
-
# NAME_FIELD
#
# The django-filter library renamed 'Filter.name' to 'Filter.field_name' in
@@ -56,32 +37,3 @@ if settings.ENABLE_REST_API:
NAME_FIELD = 'field_name'
else:
NAME_FIELD = 'name'
-
-
-# reverse, reverse_lazy
-#
-# The reverse and reverse_lazy functions have been moved to django.urls in
-# Django 1.10 and backwards compatible imports will be removed in Django 2.0
-
-if django.VERSION >= (1, 10):
- from django.urls import NoReverseMatch # noqa
- from django.urls import reverse # noqa
- from django.urls import reverse_lazy # noqa
-else:
- from django.core.urlresolvers import NoReverseMatch # noqa
- from django.core.urlresolvers import reverse # noqa
- from django.core.urlresolvers import reverse_lazy # noqa
-
-
-# is_authenticated
-#
-# models.User.is_authenticated is now an attribute in Django 1.10 instead of a
-# function
-#
-# https://docs.djangoproject.com/en/dev/releases/1.10/
-
-def is_authenticated(user):
- if django.VERSION >= (1, 10):
- return user.is_authenticated
- else:
- return user.is_authenticated()
diff --git a/patchwork/models.py b/patchwork/models.py
index 71a07c94..0409d4bf 100644
--- a/patchwork/models.py
+++ b/patchwork/models.py
@@ -30,11 +30,10 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
+from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.functional import cached_property
-from patchwork.compat import is_authenticated
-from patchwork.compat import reverse
from patchwork.fields import HashField
from patchwork.hasher import hash_diff
@@ -101,7 +100,7 @@ class Project(models.Model):
use_tags = models.BooleanField(default=True)
def is_editable(self, user):
- if not is_authenticated(user):
+ if not user.is_authenticated:
return False
return self in user.profile.maintainer_projects.all()
@@ -481,7 +480,7 @@ class Patch(SeriesMixin, Submission):
self.refresh_tag_counts()
def is_editable(self, user):
- if not is_authenticated(user):
+ if not user.is_authenticated:
return False
if user in [self.submitter.user, self.delegate]:
diff --git a/patchwork/paginator.py b/patchwork/paginator.py
index 359ec867..f565c420 100644
--- a/patchwork/paginator.py
+++ b/patchwork/paginator.py
@@ -22,8 +22,6 @@ from __future__ import absolute_import
from django.conf import settings
from django.core import paginator
-from patchwork.compat import is_authenticated
-
DEFAULT_ITEMS_PER_PAGE = 100
LONG_PAGE_THRESHOLD = 30
@@ -44,7 +42,7 @@ class Paginator(paginator.Paginator):
items_per_page = settings.DEFAULT_ITEMS_PER_PAGE
- if is_authenticated(request.user):
+ if request.user.is_authenticated:
items_per_page = request.user.profile.items_per_page
super(Paginator, self).__init__(objects, items_per_page)
diff --git a/patchwork/settings/base.py b/patchwork/settings/base.py
index f96f3694..99eb3c06 100644
--- a/patchwork/settings/base.py
+++ b/patchwork/settings/base.py
@@ -128,7 +128,7 @@ REST_FRAMEWORK = {
'rest_framework.versioning.URLPathVersioning',
'DEFAULT_PAGINATION_CLASS': 'patchwork.api.base.LinkHeaderPagination',
'DEFAULT_FILTER_BACKENDS': (
- 'patchwork.compat.DjangoFilterBackend',
+ 'django_filters.rest_framework.DjangoFilterBackend',
'rest_framework.filters.SearchFilter',
'rest_framework.filters.OrderingFilter',
),
diff --git a/patchwork/templatetags/listurl.py b/patchwork/templatetags/listurl.py
index 6b9106e9..76dae797 100644
--- a/patchwork/templatetags/listurl.py
+++ b/patchwork/templatetags/listurl.py
@@ -21,11 +21,11 @@ from __future__ import absolute_import
from django.conf import settings
from django import template
+from django.urls import reverse
+from django.urls import NoReverseMatch
from django.utils.encoding import smart_str
from django.utils.html import escape
-from patchwork.compat import reverse
-from patchwork.compat import NoReverseMatch
from patchwork.filters import filterclasses
diff --git a/patchwork/templatetags/person.py b/patchwork/templatetags/person.py
index a6f23e91..09c8d103 100644
--- a/patchwork/templatetags/person.py
+++ b/patchwork/templatetags/person.py
@@ -20,10 +20,10 @@
from __future__ import absolute_import
from django import template
+from django.urls import reverse
from django.utils.html import escape
from django.utils.safestring import mark_safe
-from patchwork.compat import reverse
from patchwork.filters import SubmitterFilter
diff --git a/patchwork/tests/api/test_bundle.py b/patchwork/tests/api/test_bundle.py
index 7c48d344..e0dd8098 100644
--- a/patchwork/tests/api/test_bundle.py
+++ b/patchwork/tests/api/test_bundle.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_bundle
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_project
diff --git a/patchwork/tests/api/test_check.py b/patchwork/tests/api/test_check.py
index 0e7e0cfc..6f4aa5de 100644
--- a/patchwork/tests/api/test_check.py
+++ b/patchwork/tests/api/test_check.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import Check
from patchwork.tests.utils import create_check
from patchwork.tests.utils import create_patch
diff --git a/patchwork/tests/api/test_comment.py b/patchwork/tests/api/test_comment.py
index f79ea469..f82c881a 100644
--- a/patchwork/tests/api/test_comment.py
+++ b/patchwork/tests/api/test_comment.py
@@ -20,9 +20,9 @@
import unittest
from django.conf import settings
+from django.urls import NoReverseMatch
+from django.urls import reverse
-from patchwork.compat import NoReverseMatch
-from patchwork.compat import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_patch
diff --git a/patchwork/tests/api/test_cover.py b/patchwork/tests/api/test_cover.py
index e4d814e4..5061d651 100644
--- a/patchwork/tests/api/test_cover.py
+++ b/patchwork/tests/api/test_cover.py
@@ -21,8 +21,8 @@ import email.parser
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_person
diff --git a/patchwork/tests/api/test_patch.py b/patchwork/tests/api/test_patch.py
index 27b99248..104f7c8a 100644
--- a/patchwork/tests/api/test_patch.py
+++ b/patchwork/tests/api/test_patch.py
@@ -22,8 +22,8 @@ from email.utils import make_msgid
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_patch
diff --git a/patchwork/tests/api/test_person.py b/patchwork/tests/api/test_person.py
index 22b12813..688a00e9 100644
--- a/patchwork/tests/api/test_person.py
+++ b/patchwork/tests/api/test_person.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_person
from patchwork.tests.utils import create_user
diff --git a/patchwork/tests/api/test_project.py b/patchwork/tests/api/test_project.py
index 129cedb7..6c5c9c6d 100644
--- a/patchwork/tests/api/test_project.py
+++ b/patchwork/tests/api/test_project.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import Project
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_project
diff --git a/patchwork/tests/api/test_series.py b/patchwork/tests/api/test_series.py
index 11324bc3..13872575 100644
--- a/patchwork/tests/api/test_series.py
+++ b/patchwork/tests/api/test_series.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_project
diff --git a/patchwork/tests/api/test_user.py b/patchwork/tests/api/test_user.py
index 873312df..4b4171ea 100644
--- a/patchwork/tests/api/test_user.py
+++ b/patchwork/tests/api/test_user.py
@@ -20,8 +20,8 @@
import unittest
from django.conf import settings
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_maintainer
from patchwork.tests.utils import create_user
diff --git a/patchwork/tests/test_about.py b/patchwork/tests/test_about.py
index f4059682..956d0324 100644
--- a/patchwork/tests/test_about.py
+++ b/patchwork/tests/test_about.py
@@ -18,8 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
-
-from patchwork.compat import reverse
+from django.urls import reverse
class AboutViewTest(TestCase):
diff --git a/patchwork/tests/test_bundles.py b/patchwork/tests/test_bundles.py
index 4461e32f..3fa556b0 100644
--- a/patchwork/tests/test_bundles.py
+++ b/patchwork/tests/test_bundles.py
@@ -25,12 +25,12 @@ import unittest
from django.conf import settings
from django.test import TestCase
+from django.urls import reverse
from django.utils.http import urlencode
from django.utils import six
from django.utils.six.moves import range
from django.utils.six.moves import zip
-from patchwork.compat import reverse
from patchwork.models import Bundle
from patchwork.models import BundlePatch
from patchwork.tests.utils import create_bundle
diff --git a/patchwork/tests/test_completion.py b/patchwork/tests/test_completion.py
index 8297e571..8e769d4b 100644
--- a/patchwork/tests/test_completion.py
+++ b/patchwork/tests/test_completion.py
@@ -22,9 +22,9 @@ from __future__ import absolute_import
import json
from django.test import TestCase
+from django.urls import reverse
from django.utils.six.moves import range
-from patchwork.compat import reverse
from patchwork.tests.utils import create_person
diff --git a/patchwork/tests/test_confirm.py b/patchwork/tests/test_confirm.py
index ed264313..7d805300 100644
--- a/patchwork/tests/test_confirm.py
+++ b/patchwork/tests/test_confirm.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import EmailConfirmation
from patchwork.tests.utils import create_user
diff --git a/patchwork/tests/test_detail.py b/patchwork/tests/test_detail.py
index 5d8534ea..f119da05 100644
--- a/patchwork/tests/test_detail.py
+++ b/patchwork/tests/test_detail.py
@@ -20,8 +20,8 @@
from __future__ import absolute_import
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_cover
from patchwork.tests.utils import create_patch
diff --git a/patchwork/tests/test_encodings.py b/patchwork/tests/test_encodings.py
index 794d67ac..5a56d4b1 100644
--- a/patchwork/tests/test_encodings.py
+++ b/patchwork/tests/test_encodings.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_person
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import read_patch
diff --git a/patchwork/tests/test_filters.py b/patchwork/tests/test_filters.py
index 23cf0ff0..44180f90 100644
--- a/patchwork/tests/test_filters.py
+++ b/patchwork/tests/test_filters.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_project
diff --git a/patchwork/tests/test_list.py b/patchwork/tests/test_list.py
index 2a023ac6..867d77f6 100644
--- a/patchwork/tests/test_list.py
+++ b/patchwork/tests/test_list.py
@@ -23,9 +23,9 @@ from datetime import datetime as dt
import re
from django.test import TestCase
+from django.urls import reverse
from django.utils.six.moves import zip
-from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import create_person
diff --git a/patchwork/tests/test_mail_settings.py b/patchwork/tests/test_mail_settings.py
index d38149d8..a6f49645 100644
--- a/patchwork/tests/test_mail_settings.py
+++ b/patchwork/tests/test_mail_settings.py
@@ -21,8 +21,8 @@ import re
from django.core import mail
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import EmailOptout
from patchwork.models import EmailConfirmation
from patchwork.tests.utils import create_person
diff --git a/patchwork/tests/test_mboxviews.py b/patchwork/tests/test_mboxviews.py
index 8eb3581a..b7af746b 100644
--- a/patchwork/tests/test_mboxviews.py
+++ b/patchwork/tests/test_mboxviews.py
@@ -25,8 +25,8 @@ import dateutil.tz
import email
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_comment
from patchwork.tests.utils import create_patch
from patchwork.tests.utils import create_project
diff --git a/patchwork/tests/test_paginator.py b/patchwork/tests/test_paginator.py
index b2191bbb..2f2b6e13 100644
--- a/patchwork/tests/test_paginator.py
+++ b/patchwork/tests/test_paginator.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests.utils import create_patches
from patchwork.tests.utils import create_project
from patchwork.tests.utils import create_user
diff --git a/patchwork/tests/test_projects.py b/patchwork/tests/test_projects.py
index 804bdda2..67ac1250 100644
--- a/patchwork/tests/test_projects.py
+++ b/patchwork/tests/test_projects.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.tests import utils
diff --git a/patchwork/tests/test_registration.py b/patchwork/tests/test_registration.py
index 28581eb5..2158dcf5 100644
--- a/patchwork/tests/test_registration.py
+++ b/patchwork/tests/test_registration.py
@@ -21,8 +21,8 @@ from django.contrib.auth.models import User
from django.core import mail
from django.test.client import Client
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import EmailConfirmation, Person
from patchwork.tests.utils import create_user
diff --git a/patchwork/tests/test_updates.py b/patchwork/tests/test_updates.py
index 80367f45..89f2091a 100644
--- a/patchwork/tests/test_updates.py
+++ b/patchwork/tests/test_updates.py
@@ -18,8 +18,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.models import State
from patchwork.tests.utils import create_patches
diff --git a/patchwork/tests/test_user.py b/patchwork/tests/test_user.py
index 6dd41e1f..05fe6d5e 100644
--- a/patchwork/tests/test_user.py
+++ b/patchwork/tests/test_user.py
@@ -20,8 +20,8 @@
from django.contrib.auth.models import User
from django.core import mail
from django.test import TestCase
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import EmailConfirmation
from patchwork.models import Person
from patchwork.models import UserProfile
diff --git a/patchwork/tests/test_xmlrpc.py b/patchwork/tests/test_xmlrpc.py
index 8edc07ac..a31cdde0 100644
--- a/patchwork/tests/test_xmlrpc.py
+++ b/patchwork/tests/test_xmlrpc.py
@@ -21,9 +21,9 @@ import unittest
from django.conf import settings
from django.test import LiveServerTestCase
+from django.urls import reverse
from django.utils.six.moves import xmlrpc_client
-from patchwork.compat import reverse
from patchwork.tests import utils
diff --git a/patchwork/urls.py b/patchwork/urls.py
index e90de6b2..6b1ef511 100644
--- a/patchwork/urls.py
+++ b/patchwork/urls.py
@@ -22,8 +22,8 @@ from django.conf import settings
from django.conf.urls import url, include
from django.contrib import admin
from django.contrib.auth import views as auth_views
+from django.urls import reverse_lazy
-from patchwork.compat import reverse_lazy
from patchwork.views import about as about_views
from patchwork.views import api as api_views
from patchwork.views import bundle as bundle_views
diff --git a/patchwork/views/__init__.py b/patchwork/views/__init__.py
index f8d23a38..a30b3a61 100644
--- a/patchwork/views/__init__.py
+++ b/patchwork/views/__init__.py
@@ -20,7 +20,6 @@
from django.contrib import messages
from django.shortcuts import get_object_or_404
-from patchwork.compat import is_authenticated
from patchwork.filters import Filters
from patchwork.forms import MultiplePatchForm
from patchwork.models import Bundle
@@ -230,7 +229,7 @@ def generic_list(request, project, view, view_args=None, filter_settings=None,
user = request.user
properties_form = None
- if is_authenticated(user):
+ if user.is_authenticated:
# we only pass the post data to the MultiplePatchForm if that was
# the actual form submitted
data_tmp = None
diff --git a/patchwork/views/about.py b/patchwork/views/about.py
index 24a0845e..508dec37 100644
--- a/patchwork/views/about.py
+++ b/patchwork/views/about.py
@@ -21,8 +21,7 @@
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
from django.shortcuts import render
-
-from patchwork.compat import reverse
+from django.urls import reverse
def about(request):
diff --git a/patchwork/views/bundle.py b/patchwork/views/bundle.py
index 5aa63fba..714062c3 100644
--- a/patchwork/views/bundle.py
+++ b/patchwork/views/bundle.py
@@ -24,8 +24,8 @@ from django.http import HttpResponseRedirect
from django.http import HttpResponseNotFound
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.filters import DelegateFilter
from patchwork.forms import BundleForm
from patchwork.forms import DeleteBundleForm
diff --git a/patchwork/views/comment.py b/patchwork/views/comment.py
index 987f76c5..c9763227 100644
--- a/patchwork/views/comment.py
+++ b/patchwork/views/comment.py
@@ -19,8 +19,8 @@
from django import http
from django import shortcuts
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork import models
diff --git a/patchwork/views/cover.py b/patchwork/views/cover.py
index 73f83cb9..f18a262f 100644
--- a/patchwork/views/cover.py
+++ b/patchwork/views/cover.py
@@ -22,8 +22,8 @@ from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import CoverLetter
from patchwork.models import Submission
from patchwork.views.utils import cover_to_mbox
diff --git a/patchwork/views/mail.py b/patchwork/views/mail.py
index 8afd83b3..aca7ab15 100644
--- a/patchwork/views/mail.py
+++ b/patchwork/views/mail.py
@@ -24,8 +24,8 @@ 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 django.urls import reverse
-from patchwork.compat import reverse
from patchwork.forms import EmailForm
from patchwork.models import EmailConfirmation
from patchwork.models import EmailOptout
diff --git a/patchwork/views/patch.py b/patchwork/views/patch.py
index cbd4ec39..6921882e 100644
--- a/patchwork/views/patch.py
+++ b/patchwork/views/patch.py
@@ -24,9 +24,8 @@ from django.http import HttpResponseForbidden
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from django.urls import reverse
-from patchwork.compat import reverse
-from patchwork.compat import is_authenticated
from patchwork.forms import CreateBundleForm
from patchwork.forms import PatchForm
from patchwork.models import Bundle
@@ -43,7 +42,7 @@ def patch_list(request, project_id):
context = generic_list(request, project, 'patch-list',
view_args={'project_id': project.linkname})
- if is_authenticated(request.user):
+ if request.user.is_authenticated:
context['bundles'] = request.user.bundles.all()
return render(request, 'patchwork/list.html', context)
@@ -70,7 +69,7 @@ def patch_detail(request, patch_id):
if editable:
form = PatchForm(instance=patch)
- if is_authenticated(request.user):
+ if request.user.is_authenticated:
createbundleform = CreateBundleForm()
if request.method == 'POST':
@@ -111,7 +110,7 @@ def patch_detail(request, patch_id):
form.save()
messages.success(request, 'Patch updated')
- if is_authenticated(request.user):
+ if request.user.is_authenticated:
context['bundles'] = request.user.bundles.all()
context['submission'] = patch
diff --git a/patchwork/views/project.py b/patchwork/views/project.py
index 484455c0..a2e5b2da 100644
--- a/patchwork/views/project.py
+++ b/patchwork/views/project.py
@@ -22,8 +22,8 @@ from django.contrib.auth.models import User
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render
+from django.urls import reverse
-from patchwork.compat import reverse
from patchwork.models import Patch
from patchwork.models import Project
diff --git a/patchwork/views/user.py b/patchwork/views/user.py
index 4a4958ab..8dcb407b 100644
--- a/patchwork/views/user.py
+++ b/patchwork/views/user.py
@@ -28,8 +28,8 @@ 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 django.urls import reverse
-from patchwork.compat import reverse
from patchwork.filters import DelegateFilter
from patchwork.forms import EmailForm
from patchwork.forms import RegistrationForm
diff --git a/patchwork/views/xmlrpc.py b/patchwork/views/xmlrpc.py
index 93f6035e..b02a65b6 100644
--- a/patchwork/views/xmlrpc.py
+++ b/patchwork/views/xmlrpc.py
@@ -35,11 +35,11 @@ from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.http import HttpResponseServerError
from django.views.decorators.csrf import csrf_exempt
+from django.urls import reverse
from django.utils import six
from django.utils.six.moves import xmlrpc_client
from django.utils.six.moves.xmlrpc_server import SimpleXMLRPCDispatcher
-from patchwork.compat import reverse
from patchwork.models import Check
from patchwork.models import Patch
from patchwork.models import Person
--
2.17.1
More information about the Patchwork
mailing list