mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
use import_module instead of our own hack to import the module
This commit is contained in:
parent
a397d90774
commit
fdccb61616
@ -136,15 +136,14 @@ def load_class(uri, default="gunicorn.workers.sync.SyncWorker",
|
||||
exc))
|
||||
|
||||
klass = components.pop(-1)
|
||||
|
||||
try:
|
||||
mod = __import__('.'.join(components))
|
||||
mod = import_module('.'.join(components))
|
||||
except:
|
||||
exc = traceback.format_exc()
|
||||
raise RuntimeError("class uri %r invalid or not found: \n\n[%s]" % (uri,
|
||||
exc))
|
||||
|
||||
for comp in components[1:]:
|
||||
mod = getattr(mod, comp)
|
||||
raise RuntimeError(
|
||||
"class uri %r invalid or not found: \n\n[%s]" %
|
||||
(uri, exc))
|
||||
return getattr(mod, klass)
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user