def viewgames(self): games = Game().by_user_id(self.user_id) c.test = 'asdf' if games: c.games = games c.test = 'test' return render('account/viewgames.mako')
def index(self): if self.user_id: if not User(self.user_id).valid_user(): return redirect_to('/login') else: return redirect_to('/login') c.user = self.user_id return render('account/index.mako')
def gameaction(self): self.game_id = game_id self.Game = Game(self.user_id, self.game_id) #Check if game belongs to logged in user if not self.Game.load_game(): return redirect_to('/account') else: #Game belongs to logged in user, do the stuff #self.game.load_players() self.Game.load_output_vars() #self.Game.load_curr_player() #self.Game.bet(20) c.Game = self.Game c.min_raise = self.Game.game.highestraise + self.Game.curr_player.to_call; #c.player_ids = self.Game.player_ids return render('game/index.mako') return render('ajaxgame/gameaction.mako')
def login(self): #check to see if already logged in if User(self.user_id).valid_user(): return redirect_to('/account') #Checl to see if fields were even filled in if len(request.params) > 1: post_email = request.params['email'] post_password = request.params['password'] #Make sure both email and password were filled in if (post_email != '' and post_password != ''): user = User().valid_login(post_email, post_password) if user: session['user'] = user.id session.save() return redirect_to('/account') else: #TODO Add error that username/password don't match return render('account/login.mako') else: #TODO One field was left blank pass return render('account/login.mako')
def index(self, game_id=-1): self.game_id = game_id self.Game = Game(self.user_id, self.game_id) # Check if game belongs to logged in user if not self.Game.load_game(): return redirect_to("/account") else: # Game belongs to logged in user, do the stuff # self.game.load_players() self.Game.load_output_vars() # self.Game.load_curr_player() # self.Game.bet(20) c.Game = self.Game c.min_raise = self.Game.game.highestraise + self.Game.curr_player.to_call # c.player_ids = self.Game.player_ids return render("game/index.mako")
def index(self): return render('index/index.mako')