diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-23 09:55:38 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:02 -0500 |
commit | c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac (patch) | |
tree | 603d95e8ff5590283634dcb3a1c730588c7c6bfe | |
parent | e537dc89cbffee011cb985f5d6fd430dae3af000 (diff) | |
download | freeipa.git-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.tar.gz freeipa.git-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.tar.xz freeipa.git-c0bc2451dddf6be8f6f14769e2f1da8dbdaecfac.zip |
Fixed another small CLI decoding problem (multivalue args in a tuple now work)
-rw-r--r-- | ipalib/cli.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index 26828e5d..827a12d7 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): """ |