Esempio n. 1
0
    def POST(self):
        
        try:
            timeout=bool(web.input()['timeout'])
        except:
            timeout=False
        try:
            name=web.input()['name']
        except:
            name=''
        try:
            answer=web.input()['answer']
        except:
            answer=''
        try:
            bonus=web.input()['bonus']
        except:
            bonus=''

        try:
            current_game=web.localsession.current_game    
        except:
            current_game=None
        
        try:    
            if current_game is None:
                if name!='':
                    current_game=game.Game(name)
                else:
                    return view.index()
            if (answer!='' or timeout or bonus!=''):
                current_game.check_answer(answer,timeout,bonus)
            question=current_game.get_question()
            web.localsession.current_game=current_game
            if current_game.is_over():
                web.localsession.kill()
            return view.quiz(current_game.username,question,current_game.is_over(), \
                             current_game.is_complete(),current_game.is_timed_out(),current_game.question_number, \
                             current_game.level,web.utils.commify(current_game.score),current_game.lifes,current_game.timer,current_game.is_special_question_enabled(),current_game.ranking,current_game.get_bonus_percentage())
        except Exception as e:
            print e
            web.localsession.kill()
            return view.oops()
Esempio n. 2
0
def internalerror():
    return web.notfound(view.oops())
Esempio n. 3
0
def notfound():
    return web.notfound(view.oops())