[Libreoffice-commits] core.git: pyuno/source

David Bolen db3l.net at gmail.com
Wed Jul 24 06:37:38 PDT 2013


 pyuno/source/module/uno.py |   12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

New commits:
commit fbe28de6fbfdce41544e4e93168d32661add8285
Author: David Bolen <db3l.net at gmail.com>
Date:   Wed Jul 24 07:07:14 2013 -0400

    fdo#66025: Simplify new ImportError logic
    
    Signed-off-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py
index d5da804..15af94a 100644
--- a/pyuno/source/module/uno.py
+++ b/pyuno/source/module/uno.py
@@ -279,15 +279,14 @@ def _uno_import( name, *optargs, **kwargs ):
         d = mod.__dict__
 
     RuntimeException = pyuno.getClass( "com.sun.star.uno.RuntimeException" )
-    unknown = object() # unknown/missing sentinel
     for x in fromlist:
        if x not in d:
-          d[x] = unknown
+          failed = False
           if x.startswith( "typeOf" ):
              try: 
                 d[x] = pyuno.getTypeByName( name + "." + x[6:len(x)] )
              except RuntimeException:
-                pass
+                failed = True
           else:
             try:
                 # check for structs, exceptions or interfaces
@@ -301,12 +300,9 @@ def _uno_import( name, *optargs, **kwargs ):
                    try:
                       d[x] = getConstantByName( name + "." + x )
                    except RuntimeException:
-                      pass
-
-          if d[x] is unknown:
-             # Remove unknown placeholder we created
-             del d[x]
+                      failed = True
 
+          if failed:
              # This can be a bad uno reference, or it can just result from any
              # python import failure (in a "from xxx import yyy" statement).
              # Synthesize a general purpose exception, reusing the original


More information about the Libreoffice-commits mailing list