From 6b0bf72bb8ba3e6ff1e7a334e6a23d95e8c2944a Mon Sep 17 00:00:00 2001 From: David De Sousa Date: Tue, 2 Jan 2018 10:59:08 +0100 Subject: [PATCH] using rsplit to get module and classname for imports (#5712) --- rest_framework/settings.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rest_framework/settings.py b/rest_framework/settings.py index db92b7a7b..6c581f8e8 100644 --- a/rest_framework/settings.py +++ b/rest_framework/settings.py @@ -179,8 +179,7 @@ def import_from_string(val, setting_name): """ try: # Nod to tastypie's use of importlib. - parts = val.split('.') - module_path, class_name = '.'.join(parts[:-1]), parts[-1] + module_path, class_name = val.rsplit('.', 1) module = import_module(module_path) return getattr(module, class_name) except (ImportError, AttributeError) as e: