Bugfix: the goban table declaration was wrong before. this (among other things) prevented saving move to the database.

This commit is contained in:
phear 2005-12-14 17:36:05 +00:00
parent 87a9d0e6fc
commit 1e1ffa362e
2 changed files with 7 additions and 10 deletions

View file

@ -39,12 +39,11 @@ class GobanTable(SQLObject):
player1 = StringCol() player1 = StringCol()
player2 = StringCol() player2 = StringCol()
size = IntCol() size = IntCol()
#name = StringCol(default=helper.generate_game_name(), unique=True,notNone=True,alternateID=True) turn_number = IntCol(default=1)
turn_number = 1
description = StringCol(default=None) description = StringCol(default=None)
sgf = gnugo.create_sgf_file(size) sgf = StringCol(default=gnugo.create_sgf_file(size))
created = int(time.time()) created = IntCol(default=int(time.time()))
lastmove = int(time.time()) lastmove = IntCol(default=int(time.time()))
def players(self): def players(self):
"""returns both player names as a tuple""" """returns both player names as a tuple"""
@ -72,7 +71,7 @@ class Users(SQLObject):
timeout - when does session time out? timeout - when does session time out?
""" """
username = StringCol(unique=True,notNone=True,alternateID=True) username = StringCol(unique=True,notNone=True,alternateID=True)
password = StringCol() password = StringCol(notNone=True)
game1 = StringCol(default=None) game1 = StringCol(default=None)
game2 = StringCol(default=None) game2 = StringCol(default=None)
game3 = StringCol(default=None) game3 = StringCol(default=None)

View file

@ -51,9 +51,7 @@ class PlayGame:
sessionid = cpg.request.sessionMap["_sessionId"] sessionid = cpg.request.sessionMap["_sessionId"]
if myuser.sessionid == sessionid: if myuser.sessionid == sessionid:
if coord != None: if coord != None:
ret = self.process_form(game,coord) return self.process_form(game,coord)
if ret == "":
return self.display_goban(game)
else: else:
return self.display_goban(game) return self.display_goban(game)
@ -126,7 +124,7 @@ class PlayGame:
mygame.sgf = new_sgf mygame.sgf = new_sgf
mygame.turn_number = turn + 1 mygame.turn_number = turn + 1
mygame.set_time() mygame.set_time()
return "" return self.display_goban(gamename)
else: #move not ok else: #move not ok
settings["Data.Message"] = "This is not a legal move (says Gnugo)." settings["Data.Message"] = "This is not a legal move (says Gnugo)."
return self.display_goban(gamename,settings) return self.display_goban(gamename,settings)