From d1e6a0d1d3debae50c7265c54d90326c2c0867bc Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 9 Nov 2017 06:47:33 -0800 Subject: [PATCH] fix seed comparison: ints vs strings Was coming in as a string when called via curl. This may be a problem for other ints if I go with lots of params instead of a json, which is looking less likely. --- xwords4/android/scripts/relay.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xwords4/android/scripts/relay.py b/xwords4/android/scripts/relay.py index 486f67f37..cea60aa0c 100755 --- a/xwords4/android/scripts/relay.py +++ b/xwords4/android/scripts/relay.py @@ -28,12 +28,15 @@ PRX_GET_MSGS = 4 # now? [Note: much of this is PENDING] def join(req, devID, room, seed, hid = 0, lang = 1, nInGame = 2, nHere = 1, inviteID = None): + assert hid <= 4 + seed = int(seed) + assert seed != 0 + connname = None + logs = [] # for debugging con = psycopg2.connect(database='xwgames') cur = con.cursor() - - assert hid <= 4 - assert seed != 0 + # cur.execute('LOCK TABLE games IN ACCESS EXCLUSIVE MODE') # First see if there's a game with a space for me. Must match on # room, lang and size. Must have room OR must have already given a @@ -95,7 +98,7 @@ def join(req, devID, room, seed, hid = 0, lang = 1, nInGame = 2, nHere = 1, invi con.commit() con.close() - result = {'connname': connname, 'hid' : hid} + result = {'connname': connname, 'hid' : hid, 'log' : ':'.join(logs)} return json.dumps(result)