python-gnupg/gnupg
Garrett Robinson f8ccdc5028 Fix `GPG.encrypt` for file-like objects
`GPG.encrypt_file` was refactored into `GPG.encrypt` in 295d98f, which
broke the functionality of `GPG.encrypt_file` for encrypting file-like
stream objects such as StringIO, BytesIO, etc.

The main difference between `GPG.encrypt_file` and `GPG.encrypt` is that
`GPG.encrypt` first converts its `data` argument into a binary stream
via `_make_binary_stream`. This is unnecessary when the argument is
already a stream, as was often the case in calls to `GPG.encrypt_file`.
Additionally, `_make_binary_stream` typically fails when it attempts
to encode a stream object, which means it is no longer possible to
achieve the functionality of `GPG.encrypt_file` with `GPG.encrypt` after
the refactor.

This commit only converts `data` to a binary stream if it is not already
a stream, re-using `_util._is_stream` to make that determination.
2015-01-17 16:09:39 -08:00
..
test Change ListPackets.key to be backwards compatible. 2014-11-27 02:35:52 +00:00
__init__.py fix sphinx errors&warnings; some pep8 2013-10-14 01:24:17 -03:00
_ansistrm.py Change LICENSE to GPLv3+, after discussion with intrigeri. 2013-07-27 19:27:53 +00:00
_logger.py more py2.6 fixes 2014-04-23 14:49:24 +02:00
_meta.py Add throw_keyids=bool option to encrypt() method. 2014-11-27 02:19:34 +00:00
_parsers.py Change ListPackets.key to be backwards compatible. 2014-11-27 02:35:52 +00:00
_trust.py properly pass argument during trustdb repair 2014-10-02 04:56:56 -05:00
_util.py Use process uids and usernames on Unix and Windows respectively. 2014-11-27 00:03:27 +00:00
_version.py Change versioneer parameters in gnupg/_version.py to match setup.py. 2014-11-19 21:44:53 +00:00
copyleft.py Change LICENSE to GPLv3+, after discussion with intrigeri. 2013-07-27 19:27:53 +00:00
gnupg.py Fix `GPG.encrypt` for file-like objects 2015-01-17 16:09:39 -08:00