Skip to content

Commit 6b0bf72

Browse files
dedsmcarltongibson
authored andcommitted
using rsplit to get module and classname for imports (#5712)
1 parent 0712094 commit 6b0bf72

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

rest_framework/settings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ def import_from_string(val, setting_name):
179179
"""
180180
try:
181181
# Nod to tastypie's use of importlib.
182-
parts = val.split('.')
183-
module_path, class_name = '.'.join(parts[:-1]), parts[-1]
182+
module_path, class_name = val.rsplit('.', 1)
184183
module = import_module(module_path)
185184
return getattr(module, class_name)
186185
except (ImportError, AttributeError) as e:

0 commit comments

Comments
 (0)