[Freeipa-devel] [PATCH 0139] otptoken-add: improve the robustness of QR code printing to tty
Jan Cholasta
jcholast at redhat.com
Tue Mar 8 16:35:37 UTC 2016
Hi,
On 8.3.2016 16:21, Martin Babinsky wrote:
> https://fedorahosted.org/freeipa/ticket/5700
1) Instead of checking for utf-8 in particular, I would prefer a more
robust approach:
try:
qr = qrcode.QRCode()
qr.add_data('test')
qr.make()
qr.print_ascii(tty=True)
except UnicodeError:
# it is not printable
else:
# it is printable
2) There is no os.isatty() check to see if stdout is actually a tty.
Honza
--
Jan Cholasta
More information about the Freeipa-devel
mailing list