python: Try to be more helpful when given a string to encrypt().
authorTobias Mueller <muelli@cryptobitch.de>
Fri, 2 Dec 2016 22:37:27 +0000 (23:37 +0100)
committerJustus Winter <justus@g10code.com>
Mon, 5 Dec 2016 11:44:20 +0000 (12:44 +0100)
commit05896c210f7fa9ce7b97784a75e49dc4489e9252
tree10e20776c4e885ab14ae115181ff88a5ff997321
parentfb7f4cb973abc9f5eb05eb240607be35c1be986c
python: Try to be more helpful when given a string to encrypt().

* lang/python/helpers.c (_gpg_obj2gpgme_data_t): Extended error
message.
* lang/python/tests/t-encrypt.py: Test for "encode" in error message.
--
The motivation is to help the user when encrypting fails. I claim that
it is not obvious to not being able to encrypt a string directly.  To
nudge the user into encoding it to bytes, the error message is a bit
extended.

Signed-off-by: Tobias Mueller <muelli@cryptobitch.de>
lang/python/helpers.c
lang/python/tests/t-encrypt.py