diff options
author | David Bolen <db3l.net@gmail.com> | 2013-07-24 07:07:14 -0400 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-07-24 15:26:10 +0200 |
commit | fbe28de6fbfdce41544e4e93168d32661add8285 (patch) | |
tree | 7fdac0de9f0d9db5d7e9c454b5f46658ef9e3bb4 /pyuno | |
parent | 6c098943d600db20640264d52792c09ae336fdfb (diff) |
fdo#66025: Simplify new ImportError logic
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'pyuno')
-rw-r--r-- | pyuno/source/module/uno.py | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/pyuno/source/module/uno.py b/pyuno/source/module/uno.py index d5da80464786..15af94a304fa 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 |