Python version compat adjustments

This commit is contained in:
Benjamin Dummer 2016-08-09 03:50:40 -04:00
parent b914f5fb41
commit aa36e6722f
2 changed files with 5 additions and 4 deletions

View File

@ -1,9 +1,9 @@
from importlib import import_module
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from rest_framework.compat import importlib
class RestFrameworkConfig(AppConfig):
name = 'rest_framework'
@ -18,6 +18,6 @@ class RestFrameworkConfig(AppConfig):
for app in settings.INSTALLED_APPS:
for mod_name in ['api']:
try:
import_module('%s.%s' % (app, mod_name))
importlib.import_module('%s.%s' % (app, mod_name))
except ImportError:
pass

View File

@ -23,6 +23,7 @@ from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import NoReverseMatch
from rest_framework import exceptions, renderers, views
from rest_framework.compat import six
from rest_framework.response import Response
from rest_framework.reverse import reverse
from rest_framework.schemas import SchemaGenerator
@ -347,7 +348,7 @@ class SimpleRouter(BaseRouter):
"""
def normalize(entry):
prefix, viewset, base_name = entry
if isinstance(prefix, str):
if isinstance(prefix, six.string_types):
prefix = [prefix]
return prefix, viewset, base_name