Permalink
Browse files

Fix importing of nested modules.

  • Loading branch information...
1 parent e3a3cde commit 865a813078c1b447713aeb1f1bb860c441a88365 @jsalz jsalz committed Apr 19, 2012
Showing with 7 additions and 0 deletions.
  1. +7 −0 jsonrpclib/jsonclass.py
View
@@ -129,6 +129,13 @@ def load(obj):
except ImportError:
raise TranslationError('Could not import %s from module %s.' %
(json_class_name, json_module_tree))
+
+ # The returned class is the top-level module, not the one we really
+ # want. (E.g., if we import a.b.c, we now have a.) Walk through other
+ # path components to get to b and c.
+ for i in json_module_parts[1:]:
+ temp_module = getattr(temp_module, i)
+
json_class = getattr(temp_module, json_class_name)
# Creating the object...
new_obj = None

0 comments on commit 865a813

Please sign in to comment.