webgo/deletegame.py
phear a000c9dd9a fixed 3 bugs:
- check for timeout in gamecreation.py
- game deletion did not work correctly
- game creation always wrote to the first game slot.
2005-12-14 14:23:14 +00:00

22 lines
488 B
Python

import helper,database
def main(gamename):
"""
manage the removal of game from game slots of players and
delete game from database.
TODO: add option do undo deletion when a failure happens
"""
#get player names from game table in database
mygame=database.GobanTable.get(gamename)
players = mygame.players()
#free game slots of players
for player in players:
myuser = database.Users.byUsername(player)
myuser.remove_game(gamename)
#delete table
mygame.destroySelf()