python bindings: fixing decrypt-verify
authorBen McGinnes <ben@adversary.org>
Sun, 30 Sep 2018 09:32:45 +0000 (19:32 +1000)
committerBen McGinnes <ben@adversary.org>
Sun, 30 Sep 2018 09:32:45 +0000 (19:32 +1000)
* lang/python/src/core.py: First restoring the exception to the being
  just that.
* The means to manipulate the error output is temporarily in commented
  out code, but ought to be added to a proper test later.
* In the mean time the original test, with a very slight change, works
  again.

Tested-by: Ben McGinnes <ben@adversary.org>
Signed-off-by: Ben McGinnes <ben@adversary.org>
lang/python/src/core.py
lang/python/tests/t-decrypt-verify.py

index 17ec0ef..6e92592 100644 (file)
@@ -450,10 +450,11 @@ class Context(GpgmeWrapper):
                 try:
                     raise errors.MissingSignatures(verify_result, missing,
                                                    results=results)
-                except errors.MissingSignatures as miss_e:
-                    mse = miss_e
-                    mserr = "gpg.errors.MissingSignatures:"
-                    print(mserr, miss_e, "\n")
+                except errors.MissingSignatures as e:
+                    raise e
+                    # mse = e
+                    # mserr = "gpg.errors.MissingSignatures:"
+                    # print(mserr, miss_e, "\n")
                     # # The full details can then be found in mse.results,
                     # # mse.result, mse.missing if necessary.
                     # mse_list = []
@@ -468,7 +469,7 @@ class Context(GpgmeWrapper):
                     #         msl.append(user.email)
                     #         # msl.append(user.uid)
                     #     print(" ".join(msl))
-                    return mse
+                    # raise mse
 
         return results
 
index fcaa134..991d18c 100755 (executable)
@@ -70,7 +70,7 @@ with gpg.Context() as c:
     try:
         c.decrypt(
             open(support.make_filename("cipher-2.asc")), verify=[alpha, bob])
-    except gpg.errors.MissingSignatures as e:
+    except Exception as e:
         assert len(e.missing) == 1
         assert e.missing[0] == bob
     else: