mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fixed another small CLI decoding problem (multivalue args in a tuple now work)
This commit is contained in:
parent
e537dc89cb
commit
c0bc2451dd
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user