Skip to content

Commit

Permalink
python3 fix: bytes vs strings..
Browse files Browse the repository at this point in the history
git-svn-id: https://xpra.org/svn/Xpra/trunk@6179 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Apr 27, 2014
1 parent a085c75 commit fd37061
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/xpra/client/client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@
DETECT_LEAKS = os.environ.get("XPRA_DETECT_LEAKS", "0")=="1"


if sys.version < '3':
def b(x):
return x
else:
def b(x):
return bytes(x, 'UTF-8')


class XpraClientBase(object):
""" Base class for Xpra clients.
Provides the glue code for:
Expand Down Expand Up @@ -195,7 +203,7 @@ def send_hello(self, challenge_response=None, client_salt=None):
hello["challenge_response"] = challenge_response
if client_salt:
hello["challenge_client_salt"] = client_salt
log.debug("send_hello(%s) packet=%s", binascii.hexlify(challenge_response or ""), hello)
log.debug("send_hello(%s) packet=%s", binascii.hexlify(b(challenge_response or "", 'UTF-8')), hello)
self.send("hello", hello)
self.timeout_add(DEFAULT_TIMEOUT, self.verify_connected)

Expand Down

0 comments on commit fd37061

Please sign in to comment.