summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2011-12-12 22:12:40 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2011-12-12 22:14:50 +0100
commit7f4cb27518ec9d0916a4d6508d9f720771859c22 (patch)
treea1a91f46420cc4fc4cf89e847ffe3a60b3c2ee48 /pyuno
parent84a3f11c7a0cce586c15246079ea807aec38a439 (diff)
fix loading of python-uno module by package.module name
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/loader/pythonloader.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/pyuno/source/loader/pythonloader.py b/pyuno/source/loader/pythonloader.py
index eef1bd6274c5..7a66cfa9fc82 100644
--- a/pyuno/source/loader/pythonloader.py
+++ b/pyuno/source/loader/pythonloader.py
@@ -111,16 +111,18 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
g_loadedComponents[url] = mod
return mod
elif "vnd.openoffice.pymodule" == protocol:
- # the failure is on symbol lookup later in the parent ...
- print ("Warning: Python module loading is almost certainly pre-broken")
nSlash = dependent.rfind('/')
if -1 != nSlash:
path = unohelper.fileUrlToSystemPath( dependent[0:nSlash] )
dependent = dependent[nSlash+1:len(dependent)]
if not path in sys.path:
sys.path.append( path )
- var = __import__( dependent )
- return var
+ mod = __import__( dependent )
+ path_component, dot, rest = dependent.partition('.')
+ while dot == '.':
+ path_component, dot, rest = rest.partition('.')
+ mod = getattr(mod, path_component)
+ return mod
else:
if DEBUG:
print("Unknown protocol '" + protocol + "'");
@@ -140,7 +142,6 @@ class Loader( XImplementationLoader, XServiceInfo, unohelper.Base ):
mod = self.getModuleFromUrl( locationUrl )
implHelper = mod.__dict__.get( "g_ImplementationHelper" , None )
if DEBUG:
- print ("dump stuff")
print ("Fetched ImplHelper as " + str(implHelper))
if implHelper == None:
return mod.getComponentFactory( implementationName, self.ctx.ServiceManager, regKey )