##// END OF EJS Templates
Add explicit comment about disabled code in importstring....
Fernando Perez -
Show More
@@ -22,13 +22,20 b' def import_item(name):'
22 """Import and return bar given the string foo.bar."""
22 """Import and return bar given the string foo.bar."""
23 package = '.'.join(name.split('.')[0:-1])
23 package = '.'.join(name.split('.')[0:-1])
24 obj = name.split('.')[-1]
24 obj = name.split('.')[-1]
25 # execString = 'from %s import %s' % (package, obj)
25
26 # try:
26 # Note: the original code for this was the following. We've left it
27 # exec execString
27 # visible for now in case the new implementation shows any problems down
28 # except SyntaxError:
28 # the road, to make it easier on anyone looking for a problem. This code
29 # raise ImportError("Invalid class specification: %s" % name)
29 # should be removed once we're comfortable we didn't break anything.
30 # exec 'temp = %s' % obj
30
31 # return temp
31 ## execString = 'from %s import %s' % (package, obj)
32 ## try:
33 ## exec execString
34 ## except SyntaxError:
35 ## raise ImportError("Invalid class specification: %s" % name)
36 ## exec 'temp = %s' % obj
37 ## return temp
38
32 if package:
39 if package:
33 module = __import__(package,fromlist=[obj])
40 module = __import__(package,fromlist=[obj])
34 return module.__dict__[obj]
41 return module.__dict__[obj]
General Comments 0
You need to be logged in to leave comments. Login now