added param package to relative imports
This commit is contained in:
parent
bee7cfa6aa
commit
734730640a
|
@ -137,7 +137,7 @@ def remove_entity_headers(headers, allowed=("content-location", "expires")):
|
||||||
return headers
|
return headers
|
||||||
|
|
||||||
|
|
||||||
def import_string(module_name):
|
def import_string(module_name, package=None):
|
||||||
"""
|
"""
|
||||||
import a module or class by string path.
|
import a module or class by string path.
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ def import_string(module_name):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
module, klass = module_name.rsplit(".", 1)
|
module, klass = module_name.rsplit(".", 1)
|
||||||
module = import_module(module)
|
module = import_module(module, package=package)
|
||||||
obj = getattr(module, klass)
|
obj = getattr(module, klass)
|
||||||
if ismodule(obj):
|
if ismodule(obj):
|
||||||
return obj
|
return obj
|
||||||
|
|
Loading…
Reference in New Issue
Block a user