Skip to content

Commit f572862

Browse files
authored
Merge pull request #4862 from felixxm/issue-cleanup-importlib
Removed unnecessary importlib wrapper.
2 parents a8dbc22 + 1c437a7 commit f572862

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

rest_framework/compat.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
from django.utils import six
1818
from django.views.generic import View
1919

20-
try:
21-
import importlib # Available in Python 3.1+
22-
except ImportError:
23-
from django.utils import importlib # Will be removed in Django 1.9
24-
2520

2621
try:
2722
from django.urls import (

rest_framework/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
back to the defaults.
1919
"""
2020
from __future__ import unicode_literals
21+
from importlib import import_module
2122

2223
from django.conf import settings
2324
from django.test.signals import setting_changed
2425
from django.utils import six
2526

2627
from rest_framework import ISO_8601
27-
from rest_framework.compat import importlib
2828

2929
DEFAULTS = {
3030
# Base API policies
@@ -174,7 +174,7 @@ def import_from_string(val, setting_name):
174174
# Nod to tastypie's use of importlib.
175175
parts = val.split('.')
176176
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
177-
module = importlib.import_module(module_path)
177+
module = import_module(module_path)
178178
return getattr(module, class_name)
179179
except (ImportError, AttributeError) as e:
180180
msg = "Could not import '%s' for API setting '%s'. %s: %s." % (val, setting_name, e.__class__.__name__, e)

0 commit comments

Comments
 (0)