Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix import of dotted names.

  • Loading branch information...
commit 9ff8252706c2bd3ee2ed4ae16a0dc6a60c19bfb3 1 parent b1fdb42
@g2p g2p authored g2p committed
Showing with 3 additions and 3 deletions.
  1. +3 −3 bin/grate
View
6 bin/grate
@@ -48,9 +48,9 @@ from optparse import OptionParser, OptionGroup
def import_module(path):
# FIXME: There's a builtin for this in Python 2.7
- module, obj = path.split(':', 1)
- o = __import__(module, fromlist=[obj])
- return getattr(o, obj)
+ modname, objname = path.split(':', 1)
+ obj = __import__(modname, fromlist=[objname])
+ return reduce(getattr, objname.split('.'), obj)
def main():
Please sign in to comment.
Something went wrong with that request. Please try again.