Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.core
Commits
3b5c80ce
Commit
3b5c80ce
authored
Apr 25, 2018
by
Samuel GAIST
Browse files
[utils] Implement helper method to ensure send_multipart gets the right inputs
parent
24f99700
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/core/utils.py
View file @
3b5c80ce
...
...
@@ -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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment