Skip to content

Commit

Permalink
Improve module import from ref
Browse files Browse the repository at this point in the history
  • Loading branch information
jarekwg committed Jul 7, 2016
1 parent 9eb5dc5 commit e2f780c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apscheduler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,12 @@ def ref_to_obj(ref):

modulename, rest = ref.split(':', 1)
try:
obj = __import__(modulename)
obj = __import__(modulename, globals(), locals(), [rest])
except ImportError:
raise LookupError('Error resolving reference %s: could not import module' % ref)

try:
for name in modulename.split('.')[1:] + rest.split('.'):
for name in rest.split('.'):
obj = getattr(obj, name)
return obj
except Exception:
Expand Down

0 comments on commit e2f780c

Please sign in to comment.