diff options
author | Justus Winter <[email protected]> | 2016-05-24 10:29:32 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-05-24 11:13:35 +0000 |
commit | 09803c4a81b9431fd4c8f30abb1c60c4c735f0cb (patch) | |
tree | fd7e42c65876321b5e8d3a98027d8a14eaf57f28 /lang/python/pyme/core.py | |
parent | python: Fix hook. (diff) | |
download | gpgme-09803c4a81b9431fd4c8f30abb1c60c4c735f0cb.tar.gz gpgme-09803c4a81b9431fd4c8f30abb1c60c4c735f0cb.zip |
python: Improve support for edit callbacks.
* lang/python/helpers.c (pyEditCb): Stash exceptions.
* lang/python/pyme/core.py (Context.op_edit): Hand in 'self'.
* lang/python/tests/Makefile.am (py_tests): Add new test.
* lang/python/tests/t-callbacks.py: Test edit callbacks.
* lang/python/tests/t-edit.py: New file.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/pyme/core.py')
-rw-r--r-- | lang/python/pyme/core.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lang/python/pyme/core.py b/lang/python/pyme/core.py index 9e7faf77..1b4e6ae0 100644 --- a/lang/python/pyme/core.py +++ b/lang/python/pyme/core.py @@ -225,8 +225,15 @@ class Context(GpgmeWrapper): """Start key editing using supplied callback function""" if key == None: raise ValueError("op_edit: First argument cannot be None") - opaquedata = (func, fnc_value) - errorcheck(pygpgme.gpgme_op_edit(self.wrapped, key, opaquedata, out)) + if fnc_value: + opaquedata = (self, func, fnc_value) + else: + opaquedata = (self, func) + + result = pygpgme.gpgme_op_edit(self.wrapped, key, opaquedata, out) + if self._callback_excinfo: + pygpgme.pygpgme_raise_callback_exception(self) + errorcheck(result) class Data(GpgmeWrapper): """From the GPGME C manual: |