Skip to content
This repository

Fix for issue #15 (importing) #16

Merged
merged 1 commit into from 6 months ago

3 participants

jsalz tonybarbieri Josh Marshall
tonybarbieri

We ran into this issue today as well. I was going to put a pull request in for the fix but you beat me too it. Thanks for sharing!

Josh Marshall joshmarshall merged commit 53c8ffc into from
Josh Marshall joshmarshall closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 20, 2012
jsalz Fix importing of nested modules. 865a813
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 7 additions and 0 deletions. Show diff stats Hide diff stats

  1. 7  jsonrpclib/jsonclass.py
7  jsonrpclib/jsonclass.py
@@ -129,6 +129,13 @@ def load(obj):
129 129
         except ImportError:
130 130
             raise TranslationError('Could not import %s from module %s.' %
131 131
                                    (json_class_name, json_module_tree))
  132
+
  133
+        # The returned class is the top-level module, not the one we really
  134
+        # want.  (E.g., if we import a.b.c, we now have a.)  Walk through other
  135
+        # path components to get to b and c.
  136
+        for i in json_module_parts[1:]:
  137
+            temp_module = getattr(temp_module, i)
  138
+
132 139
         json_class = getattr(temp_module, json_class_name)
133 140
     # Creating the object...
134 141
     new_obj = None
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.