Skip to content

Commit

Permalink
Remove include compat
Browse files Browse the repository at this point in the history
  • Loading branch information
carltongibson committed Oct 5, 2017
1 parent a65f141 commit bfb5119
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 17 deletions.
9 changes: 0 additions & 9 deletions rest_framework/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,15 +305,6 @@ def set_rollback():
pass


# TODO: Remove
def include(module, namespace=None, app_name=None):
from django.conf.urls import include
if django.VERSION < (1,9):
return include(module, namespace, app_name)
else:
return include((module, app_name), namespace)


def authenticate(request=None, **credentials):
from django.contrib.auth import authenticate
if django.VERSION < (1, 11):
Expand Down
7 changes: 3 additions & 4 deletions rest_framework/urlpatterns.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from __future__ import unicode_literals

from django.conf.urls import url
from django.conf.urls import include, url

from rest_framework.compat import RegexURLResolver, include
from rest_framework.compat import RegexURLResolver
from rest_framework.settings import api_settings


Expand All @@ -19,8 +19,7 @@ def apply_suffix_patterns(urlpatterns, suffix_pattern, suffix_required):
patterns = apply_suffix_patterns(urlpattern.url_patterns,
suffix_pattern,
suffix_required)
ret.append(url(regex, include(patterns, namespace, app_name), kwargs))

ret.append(url(regex, include((patterns, app_name), namespace), kwargs))
else:
# Regular URL pattern
regex = urlpattern.regex.pattern.rstrip('$').rstrip('/') + suffix_pattern
Expand Down
3 changes: 1 addition & 2 deletions tests/test_routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
from collections import namedtuple

import pytest
from django.conf.urls import url
from django.conf.urls import include, url
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.test import TestCase, override_settings

from rest_framework import permissions, serializers, viewsets
from rest_framework.compat import include
from rest_framework.decorators import detail_route, list_route
from rest_framework.response import Response
from rest_framework.routers import DefaultRouter, SimpleRouter
Expand Down
3 changes: 1 addition & 2 deletions tests/test_versioning.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import pytest
from django.conf.urls import url
from django.conf.urls import include, url
from django.test import override_settings

from rest_framework import serializers, status, versioning
from rest_framework.compat import include
from rest_framework.decorators import APIView
from rest_framework.relations import PKOnlyObject
from rest_framework.response import Response
Expand Down

0 comments on commit bfb5119

Please sign in to comment.