mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
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.
This commit is contained in:
parent
d0dd7a2c02
commit
d1e6a0d1d3
1 changed files with 7 additions and 4 deletions
|
@ -28,12 +28,15 @@ PRX_GET_MSGS = 4
|
||||||
# now? [Note: much of this is PENDING]
|
# now? [Note: much of this is PENDING]
|
||||||
|
|
||||||
def join(req, devID, room, seed, hid = 0, lang = 1, nInGame = 2, nHere = 1, inviteID = None):
|
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
|
connname = None
|
||||||
|
logs = [] # for debugging
|
||||||
con = psycopg2.connect(database='xwgames')
|
con = psycopg2.connect(database='xwgames')
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
|
# cur.execute('LOCK TABLE games IN ACCESS EXCLUSIVE MODE')
|
||||||
assert hid <= 4
|
|
||||||
assert seed != 0
|
|
||||||
|
|
||||||
# First see if there's a game with a space for me. Must match on
|
# 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
|
# 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.commit()
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
result = {'connname': connname, 'hid' : hid}
|
result = {'connname': connname, 'hid' : hid, 'log' : ':'.join(logs)}
|
||||||
|
|
||||||
return json.dumps(result)
|
return json.dumps(result)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue