31 lines
No EOL
825 B
Python
31 lines
No EOL
825 B
Python
import login,helper,database
|
|
|
|
#helper = apache.import_module("helper")
|
|
|
|
def main(req,form):
|
|
"""
|
|
get request,util.FieldStorage.
|
|
manage the removal of game from game slots of players and
|
|
delete game from database.
|
|
"""
|
|
helper.debug(req,form,str(form.keys())+" sessionid in form:"+form["sessionid"]+"<br>")
|
|
try:
|
|
gamename = form["game"]
|
|
except:
|
|
gamename = ""
|
|
if gamename != "":
|
|
#get player names from game table in database
|
|
mygame=database.GobanTable.byName(gamename)
|
|
players = mygame.players()
|
|
#free game slots of players
|
|
for player in players:
|
|
myuser = database.Users.byUsername(player)
|
|
myuser.removegame(gamename)
|
|
|
|
#delete table
|
|
mygame.destroySelf()
|
|
#now display game overview form.
|
|
login.game_overview_form(req,form)
|
|
|
|
else:
|
|
req.write('Error: You have to select a game to delete it!') |