proto.py: Fix base64 encoding in make_protobuf

First issue: Cannot check for presence of list in dictionary
because it is not hashable.
Second issue: Wrong function name was being used (make_proto
instead of _make_protobuf)

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-02-25 19:56:09 -08:00 committed by Jesús
parent d604a007a9
commit 889dabb112
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -149,8 +149,8 @@ def _make_protobuf(data):
data = new_data data = new_data
if isinstance(data, str): if isinstance(data, str):
return data.encode('utf-8') return data.encode('utf-8')
elif len(data) == 2 and data[0] in base64_enc_funcs: elif len(data) == 2 and data[0] in list(base64_enc_funcs.keys()):
return base64_enc_funcs[data[0]](make_proto(data[1])) return base64_enc_funcs[data[0]](_make_protobuf(data[1]))
elif isinstance(data, list): elif isinstance(data, list):
result = b'' result = b''
for field in data: for field in data: