import goban,helper,psql def main(req,form): """ display selected goban and manage user input. """ req.write(str(form.keys())+"
") try: gamename = form["game"] except: gamename = "" if gamename != "": #do stuff data = helper.header() #read goban table from database tmplist = psql.read_table(gamename) #make a dictionary out of the list gobandict = psql.fetchall_list_to_goban_dict(tmplist) #print goban #data += "

Turn number: %s, %s Player's Move.

" % (gobandict["turn_number"],("White","Black")[gobandict["turn_number"] % 2]) #eleet ;> #check whether its our turn #if yes: print 'your move' and display goban and process move #if not: print '...s move' and display goban. data += goban.display_goban(gobandict,req,form) data += helper.footer() req.write(data) else: req.write('Error: You have to select a game to play it!')