2005-12-13 11:10:34 +01:00
|
|
|
import helper,database
|
2005-09-23 16:37:07 +02:00
|
|
|
|
2005-09-12 19:30:02 +02:00
|
|
|
|
2005-12-13 11:10:34 +01:00
|
|
|
|
|
|
|
def main(gamename):
|
2005-09-12 19:30:02 +02:00
|
|
|
"""
|
2005-12-13 11:10:34 +01:00
|
|
|
|
2005-09-12 19:30:02 +02:00
|
|
|
manage the removal of game from game slots of players and
|
|
|
|
delete game from database.
|
2005-12-13 11:10:34 +01:00
|
|
|
TODO: add option do undo deletion when a failure happens
|
2005-09-14 16:29:58 +02:00
|
|
|
"""
|
2005-12-13 11:10:34 +01:00
|
|
|
#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)
|
2005-12-14 15:23:14 +01:00
|
|
|
myuser.remove_game(gamename)
|
2005-12-13 11:10:34 +01:00
|
|
|
|
|
|
|
#delete table
|
|
|
|
mygame.destroySelf()
|