2005-11-23 18:34:20 +01:00
|
|
|
import login,helper,database
|
2005-09-23 16:37:07 +02:00
|
|
|
|
|
|
|
#helper = apache.import_module("helper")
|
2005-09-12 19:30:02 +02:00
|
|
|
|
2005-09-14 16:29:58 +02:00
|
|
|
def main(req,form):
|
2005-09-12 19:30:02 +02:00
|
|
|
"""
|
2005-09-20 11:51:12 +02:00
|
|
|
get request,util.FieldStorage.
|
2005-09-12 19:30:02 +02:00
|
|
|
manage the removal of game from game slots of players and
|
|
|
|
delete game from database.
|
2005-09-14 16:29:58 +02:00
|
|
|
"""
|
2005-10-03 23:45:39 +02:00
|
|
|
helper.debug(req,form,str(form.keys())+" sessionid in form:"+form["sessionid"]+"<br>")
|
2005-09-14 16:29:58 +02:00
|
|
|
try:
|
|
|
|
gamename = form["game"]
|
|
|
|
except:
|
|
|
|
gamename = ""
|
|
|
|
if gamename != "":
|
|
|
|
#get player names from game table in database
|
2005-11-23 18:34:20 +01:00
|
|
|
mygame=database.GobanTable.byName(gamename)
|
|
|
|
players = mygame.players()
|
2005-09-14 16:29:58 +02:00
|
|
|
#free game slots of players
|
|
|
|
for player in players:
|
2005-11-23 18:34:20 +01:00
|
|
|
myuser = database.Users.byUsername(player)
|
|
|
|
myuser.removegame(gamename)
|
2005-09-14 16:29:58 +02:00
|
|
|
|
|
|
|
#delete table
|
2005-11-23 18:34:20 +01:00
|
|
|
mygame.destroySelf()
|
2005-09-14 16:29:58 +02:00
|
|
|
#now display game overview form.
|
2005-09-20 11:16:13 +02:00
|
|
|
login.game_overview_form(req,form)
|
2005-09-14 16:29:58 +02:00
|
|
|
|
|
|
|
else:
|
|
|
|
req.write('Error: You have to select a game to delete it!')
|