Skip to content

Commit

Permalink
Merge pull request #965 from finos/fix-csv
Browse files Browse the repository at this point in the history
PerspectiveManager no longer treats `str` as `bytes` in Python 2
  • Loading branch information
texodus authored Mar 9, 2020
2 parents 409e068 + 742c3b2 commit 62c975e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/perspective/perspective/manager/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,11 @@ def _process_method_call(self, msg, post_callback, client_id):
elif msg["method"] != "delete":
# otherwise parse args as list
result = getattr(table_or_view, msg["method"])(*args)
if type(result) == bytes:
# return result to the client without JSON serialization
if isinstance(result, bytes) and msg["method"] != "to_csv":
# return a binary to the client without JSON serialization,
# i.e. when we return an Arrow. If a method is added that
# returns a string, this condition needs to be updated as
# an Arrow binary is both `str` and `bytes` in Python 2.
self._process_bytes(result, msg, post_callback)
else:
# return the result to the client
Expand Down

0 comments on commit 62c975e

Please sign in to comment.