mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Set default encoding to utf-8, use unicode when printing output.
The Gettext() object only does the lookup when you print it as a unicode. ticket 308
This commit is contained in:
parent
0ef9d88104
commit
6220b53893
@ -32,6 +32,7 @@ import fcntl
|
|||||||
import termios
|
import termios
|
||||||
import struct
|
import struct
|
||||||
import base64
|
import base64
|
||||||
|
import default_encoding_utf8
|
||||||
|
|
||||||
import frontend
|
import frontend
|
||||||
import backend
|
import backend
|
||||||
@ -153,7 +154,7 @@ class textui(backend.Backend):
|
|||||||
"""
|
"""
|
||||||
Print exactly like ``print`` statement would.
|
Print exactly like ``print`` statement would.
|
||||||
"""
|
"""
|
||||||
print string
|
print unicode(string)
|
||||||
|
|
||||||
def print_line(self, text, width=None):
|
def print_line(self, text, width=None):
|
||||||
"""
|
"""
|
||||||
@ -175,7 +176,7 @@ class textui(backend.Backend):
|
|||||||
width = self.get_tty_width()
|
width = self.get_tty_width()
|
||||||
if width is not None and width < len(text):
|
if width is not None and width < len(text):
|
||||||
text = text[:width - 3] + '...'
|
text = text[:width - 3] + '...'
|
||||||
print text
|
print unicode(text)
|
||||||
|
|
||||||
def print_paragraph(self, text, width=None):
|
def print_paragraph(self, text, width=None):
|
||||||
"""
|
"""
|
||||||
@ -479,7 +480,7 @@ class textui(backend.Backend):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def print_error(self, text):
|
def print_error(self, text):
|
||||||
print ' ** %s **' % text
|
print ' ** %s **' % unicode(text)
|
||||||
|
|
||||||
def prompt(self, label, default=None, get_values=None):
|
def prompt(self, label, default=None, get_values=None):
|
||||||
"""
|
"""
|
||||||
@ -504,7 +505,7 @@ class textui(backend.Backend):
|
|||||||
while True:
|
while True:
|
||||||
pw1 = getpass.getpass('%s: ' % label)
|
pw1 = getpass.getpass('%s: ' % label)
|
||||||
pw2 = getpass.getpass(
|
pw2 = getpass.getpass(
|
||||||
_('Enter %(label)s again to verify: ') % dict(label=label)
|
unicode(_('Enter %(label)s again to verify: ') % dict(label=label))
|
||||||
)
|
)
|
||||||
if pw1 == pw2:
|
if pw1 == pw2:
|
||||||
return self.decode(pw1)
|
return self.decode(pw1)
|
||||||
|
Loading…
Reference in New Issue
Block a user