summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2010-10-06 14:08:39 -0400
committerRob Crittenden <rcritten@redhat.com>2010-10-22 21:39:53 -0400
commit6220b5389383f58d5f0eb4b37e3e588ac6ac054b (patch)
tree1d472852baf02c85ba7252554f8da6f1b9490ce9 /ipalib/cli.py
parent0ef9d8810403b68a11c98e92761b63a8d280438a (diff)
downloadfreeipa-6220b5389383f58d5f0eb4b37e3e588ac6ac054b.tar.gz
freeipa-6220b5389383f58d5f0eb4b37e3e588ac6ac054b.tar.xz
freeipa-6220b5389383f58d5f0eb4b37e3e588ac6ac054b.zip
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
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index dff709af0..e8242bfd2 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -32,6 +32,7 @@ import fcntl
import termios
import struct
import base64
+import default_encoding_utf8
import frontend
import backend
@@ -153,7 +154,7 @@ class textui(backend.Backend):
"""
Print exactly like ``print`` statement would.
"""
- print string
+ print unicode(string)
def print_line(self, text, width=None):
"""
@@ -175,7 +176,7 @@ class textui(backend.Backend):
width = self.get_tty_width()
if width is not None and width < len(text):
text = text[:width - 3] + '...'
- print text
+ print unicode(text)
def print_paragraph(self, text, width=None):
"""
@@ -479,7 +480,7 @@ class textui(backend.Backend):
)
def print_error(self, text):
- print ' ** %s **' % text
+ print ' ** %s **' % unicode(text)
def prompt(self, label, default=None, get_values=None):
"""
@@ -504,7 +505,7 @@ class textui(backend.Backend):
while True:
pw1 = getpass.getpass('%s: ' % label)
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:
return self.decode(pw1)