summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-23 09:55:38 -0700
committerRob Crittenden <rcritten@redhat.com>2009-02-03 15:29:02 -0500
commitc0bc2451dddf6be8f6f14769e2f1da8dbdaecfac (patch)
tree603d95e8ff5590283634dcb3a1c730588c7c6bfe /ipalib/cli.py
parente537dc89cbffee011cb985f5d6fd430dae3af000 (diff)
downloadfreeipa-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.tar.gz
freeipa-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.tar.xz
freeipa-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.zip
Fixed another small CLI decoding problem (multivalue args in a tuple now work)
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index 26828e5d1..827a12d70 100644
--- a/ipalib/cli.py
+++ b/ipalib/cli.py
@@ -110,19 +110,19 @@ class textui(backend.Backend):
def __get_encoding(self, stream):
assert stream in (sys.stdin, sys.stdout)
if stream.encoding is None:
- if stream.isatty():
- return sys.getdefaultencoding()
return 'UTF-8'
return stream.encoding
- def decode(self, str_buffer):
+ def decode(self, value):
"""
Decode text from stdin.
"""
- if type(str_buffer) is str:
+ if type(value) is str:
encoding = self.__get_encoding(sys.stdin)
- return str_buffer.decode(encoding)
- return str_buffer
+ return value.decode(encoding)
+ elif type(value) in (list, tuple):
+ return tuple(self.decode(v) for v in value)
+ return value
def encode(self, unicode_text):
"""