From f3f2ecc45e126da711f1a9b5f9ede0dc9cef47be Mon Sep 17 00:00:00 2001 From: Graham Ullrich Date: Wed, 24 Jan 2018 17:19:31 -0700 Subject: [PATCH] Remove unneeded compatibility --- README.md | 4 ++++ pinax/notifications/compat.py | 19 ------------------- pinax/notifications/conf.py | 5 ++--- pinax/notifications/models.py | 2 +- pinax/notifications/tests/test_views.py | 2 +- setup.py | 2 +- 6 files changed, 9 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 23d7feee..c947ce6d 100644 --- a/README.md +++ b/README.md @@ -472,6 +472,10 @@ urlpatterns = [ ## Change Log +### 5.0.2 + +* Remove unneeded compatibility + ### 5.0.1 * Fix bytestring decoding bug diff --git a/pinax/notifications/compat.py b/pinax/notifications/compat.py index 1b9dc3e0..82d63749 100644 --- a/pinax/notifications/compat.py +++ b/pinax/notifications/compat.py @@ -1,8 +1,3 @@ -try: - from django.contrib.contenttypes.fields import GenericForeignKey -except ImportError: - from django.contrib.contenttypes.generic import GenericForeignKey # noqa - try: from urllib import quote except ImportError: @@ -17,17 +12,3 @@ from account.decorators import login_required except ImportError: from django.contrib.auth.decorators import login_required # noqa - -try: - from django.apps import apps as django_apps - get_model = django_apps.get_model -except ImportError: - from django.db.models import get_model as old_get_model # noqa - - def get_model(path): - return old_get_model(*path.split(".")) - -try: - from django.urls import reverse -except ImportError: - from django.core.urlresolvers import reverse # noqa diff --git a/pinax/notifications/conf.py b/pinax/notifications/conf.py index 25c58017..8b9ec90b 100644 --- a/pinax/notifications/conf.py +++ b/pinax/notifications/conf.py @@ -2,17 +2,16 @@ import importlib +from django.apps import apps as django_apps from django.conf import settings # noqa from django.core.exceptions import ImproperlyConfigured from appconf import AppConf -from .compat import get_model - def load_model(path): try: - return get_model(path) + return django_apps.get_model(path) except ValueError: raise ImproperlyConfigured( "{0} must be of the form 'app_label.model_name'".format(path) diff --git a/pinax/notifications/models.py b/pinax/notifications/models.py index f7739afd..1ffb299f 100644 --- a/pinax/notifications/models.py +++ b/pinax/notifications/models.py @@ -2,6 +2,7 @@ import base64 +from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ImproperlyConfigured from django.db import models @@ -11,7 +12,6 @@ from django.utils.translation import ugettext_lazy as _ from django.utils.translation import activate, get_language -from .compat import GenericForeignKey from .conf import settings from .hooks import hookset from .utils import load_media_defaults diff --git a/pinax/notifications/tests/test_views.py b/pinax/notifications/tests/test_views.py index f875c809..86216ba3 100644 --- a/pinax/notifications/tests/test_views.py +++ b/pinax/notifications/tests/test_views.py @@ -1,8 +1,8 @@ from django.contrib.auth import get_user_model from django.test import RequestFactory, TestCase +from django.urls import reverse from . import get_backend_id -from ..compat import reverse from ..models import NoticeSetting, NoticeType from ..views import NoticeSettingsView diff --git a/setup.py b/setup.py index a92e5521..2e57ccb0 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = "5.0.1" +VERSION = "5.0.2" LONG_DESCRIPTION = """ .. image:: http://pinaxproject.com/pinax-design/patches/pinax-notifications.svg :target: https://pypi.python.org/pypi/pinax-notifications/