diff options
author | Jan Cholasta <jcholast@redhat.com> | 2015-09-11 14:02:13 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-09-17 11:08:43 +0200 |
commit | ba5201979dfddcb4ca6bb1b68e786cb964e50bb6 (patch) | |
tree | 47b09b736a408be189a899340e07900bb9506c6a /ipalib/rpc.py | |
parent | 23507e6124041ed17f39db211e802495e37520e7 (diff) | |
download | freeipa-ba5201979dfddcb4ca6bb1b68e786cb964e50bb6.tar.gz freeipa-ba5201979dfddcb4ca6bb1b68e786cb964e50bb6.tar.xz freeipa-ba5201979dfddcb4ca6bb1b68e786cb964e50bb6.zip |
Use bytes instead of str where appropriate
Under Python 2, "str" and "bytes" are synonyms.
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipalib/rpc.py')
-rw-r--r-- | ipalib/rpc.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 4d39503a7..4d3914d6b 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -164,7 +164,7 @@ def xml_wrap(value, version): return dict( (k, xml_wrap(v, version)) for (k, v) in value.items() ) - if type(value) is str: + if type(value) is bytes: return Binary(value) if type(value) is Decimal: # transfer Decimal as a string @@ -221,7 +221,7 @@ def xml_unwrap(value, encoding='UTF-8'): if type(value) is str: return value.decode(encoding) if isinstance(value, Binary): - assert type(value.data) is str + assert type(value.data) is bytes return value.data if isinstance(value, DateTime): # xmlprc DateTime is converted to string of %Y%m%dT%H:%M:%S format @@ -290,7 +290,7 @@ def json_encode_binary(val, version): elif isinstance(val, (list, tuple)): new_list = [json_encode_binary(v, version) for v in val] return new_list - elif isinstance(val, str): + elif isinstance(val, bytes): return {'__base64__': base64.b64encode(val)} elif isinstance(val, Decimal): return {'__base64__': base64.b64encode(str(val))} |