added param package to relative imports

This commit is contained in:
Jotagê Sales 2019-03-05 01:40:17 -03:00
parent bee7cfa6aa
commit 734730640a

View File

@ -137,7 +137,7 @@ def remove_entity_headers(headers, allowed=("content-location", "expires")):
return headers
def import_string(module_name):
def import_string(module_name, package=None):
"""
import a module or class by string path.
@ -148,7 +148,7 @@ def import_string(module_name):
"""
module, klass = module_name.rsplit(".", 1)
module = import_module(module)
module = import_module(module, package=package)
obj = getattr(module, klass)
if ismodule(obj):
return obj