Commit 3b5c80ce authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[utils] Implement helper method to ensure send_multipart gets the right inputs

parent 24f99700
......@@ -64,3 +64,16 @@ def uniq(seq):
result.append(item)
return result
def send_multipart(socket, parts):
"""
Send the parts through the socket after having encoded them if
necessary.
"""
for index, item in enumerate(parts):
if isinstance(item, six.string_types):
parts[index] = item.encode('utf-8')
socket.send_multipart(parts)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment