pushyrpc / pushy

Easy-as RPC. Zero-server RPC for Python and Java.
http://github.com/pushyrpc/pushy
45 stars 18 forks source link

auto-importer doesn't support modules not imported by their parent #30

Closed axw closed 12 years ago

axw commented 12 years ago

You have a package "a", and a module within called "b", i.e.:- a/init.py a/b.py a/init.py does NOT import b.py.

The auto-importer currently is a bit dumb, assuming that the parent imports the child. Based on this assumption, a auto-import of "a.b" works as follows: getattr(getattr(conn.modules, "a"), "b")

This will fail if a doesn't import b.


Imported from Launchpad using lp2gh.

axw commented 12 years ago

(by axwalk) It is possible to get around this at the moment, by doing this: getattr(conn.modules, "a.b").b The second getattr is necessary since import is used.

I can think of a couple of options for fixing this:

I am currently thinking of doing both. If feasible, the first option should only apply to modules returned from the auto-importer.