From 6fc5bd149e8708b9aa2a1cc83ec371bede50d025 Mon Sep 17 00:00:00 2001 From: David de Sousa Date: Wed, 27 Dec 2017 17:52:47 +0100 Subject: [PATCH] using rsplit to get module and classname for imports --- 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: