diff options
| author | Alexander Bokovoy <abokovoy@redhat.com> | 2016-06-07 11:37:41 +0300 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-09 08:09:33 +0200 |
| commit | 29d669fec18c089619c199d66195ec3b73df7ee1 (patch) | |
| tree | dd45293d5a4a6cd4d30ad4e0f88f8bf743e40567 /ipaclient/plugins | |
| parent | 6b3db0dc736a74c54b41f0746f1abc2091ba1be8 (diff) | |
| download | freeipa-29d669fec18c089619c199d66195ec3b73df7ee1.tar.gz freeipa-29d669fec18c089619c199d66195ec3b73df7ee1.tar.xz freeipa-29d669fec18c089619c199d66195ec3b73df7ee1.zip | |
otptoken: support Python 3 for the qr code
When IPA client is using Python 3, there is no str.decode() method
anymore.
ipa: ERROR: AttributeError: 'str' object has no attribute 'decode'
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/ipalib/cli.py", line 1345, in run
sys.exit(api.Backend.cli.run(argv))
File "/usr/lib/python3.5/site-packages/ipalib/cli.py", line 1110, in run
rv = cmd.output_for_cli(self.api.Backend.textui, result, *args, **options)
File "/usr/lib/python3.5/site-packages/ipaclient/plugins/otptoken.py", line 103, in output_for_cli
qr = self._get_qrcode(output, uri, options['version'])
File "/usr/lib/python3.5/site-packages/ipaclient/plugins/otptoken.py", line 61, in _get_qrcode
qr_code = qr_output.getvalue().decode(encoding)
AttributeError: 'str' object has no attribute 'decode' ipa: ERROR: an internal error has occurred
Fixes https://fedorahosted.org/freeipa/ticket/5938
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient/plugins')
| -rw-r--r-- | ipaclient/plugins/otptoken.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ipaclient/plugins/otptoken.py b/ipaclient/plugins/otptoken.py index 5d3f1f8d8..d7d53562d 100644 --- a/ipaclient/plugins/otptoken.py +++ b/ipaclient/plugins/otptoken.py @@ -58,7 +58,7 @@ class otptoken_add(MethodOverride): encoding = locale.getpreferredencoding(False) try: - qr_code = qr_output.getvalue().decode(encoding) + qr_code = qr_output.getvalue().encode(encoding) except UnicodeError: add_message( version, |
