python: Make 'get_key' more idiomatic.
authorJustus Winter <justus@g10code.com>
Thu, 13 Oct 2016 11:13:23 +0000 (13:13 +0200)
committerJustus Winter <justus@g10code.com>
Thu, 13 Oct 2016 11:19:49 +0000 (13:19 +0200)
commitf526d0e22e8b881ccbca66b46a0e1b68bbc4cd6b
tree7deb5fc787f22e6104d830ca3ab4a0b72b1a07d6
parent1e6073ffa98db2c265adbcf0dbbe70c067a910f0
python: Make 'get_key' more idiomatic.

* lang/python/pyme/core.py (Context.get_key): Raise errors.KeyNotFound
if the key is not found.  This error is both a KeyError for idiomatic
error handling as well as a GPGMEError so we don't break existing
code.
* lang/python/pyme/errors.py (KeyNotFound): New class.
* lang/python/tests/support.py (no_such_key): New variable.
* lang/python/tests/t-keylist.py: Test the new behavior.

Signed-off-by: Justus Winter <justus@g10code.com>
lang/python/pyme/core.py
lang/python/pyme/errors.py
lang/python/tests/support.py
lang/python/tests/t-keylist.py