Пример #1
0
    def get(self, gamekey):
        user = users.get_current_user()

        logging.info("gamekey %s" % (gamekey, ))

        s = get_live_game(gamekey)

        if s is None:
            #TODO: something more interesting here
            self.error(404)
            return

        tok = s.registerUser(user)
        color = s.get_user_color(user)
        nick = user.nickname()

        template_params = {
            'color': color,
            'token': tok,
            'gamekey': gamekey,
            'nick': nick,
            'imageUrl': escape(model.userPicture(user.email())),
            'isOwner': (s.get_board().owner == user),
            'reservationUrl': "reserve",
            'boardUrl': "currentBoard",
            'actionUrl': "action",
            'playerUrl': "currentPlayer",
            'joinUrl': "join",
        }

        self.response.headers.add_header("Content-Type",
                                         "application/xhtml+xml")

        path = os.path.join(os.path.dirname(__file__), 'templates/game.xhtml')
        self.response.out.write(template.render(path, template_params))
Пример #2
0
 def get(self, gamekey):
     user = users.get_current_user()
     
     logging.info("gamekey %s" % (gamekey,))
     
     s = get_live_game(gamekey)
     
     if s is None:
         #TODO: something more interesting here
         self.error(404)
         return
     
     tok = s.registerUser(user)
     color = s.get_user_color(user)
     nick = user.nickname()
     
     template_params = {
         'color' : color,
         'token' : tok,
         'gamekey' : gamekey,
         'nick': nick,
         'imageUrl' : escape(model.userPicture(user.email())),
         'isOwner': (s.get_board().owner == user),
         'reservationUrl':"reserve",
         'boardUrl':"currentBoard",
         'actionUrl':"action",
         'playerUrl':"currentPlayer",
         'joinUrl':"join",
     }
     
     self.response.headers.add_header("Content-Type", "application/xhtml+xml")
     
     path = os.path.join(os.path.dirname(__file__), 'templates/game.xhtml')
     self.response.out.write(template.render(path, template_params))
Пример #3
0
 def get(self):
     user = users.get_current_user()
     
     template_params = {
         'user' : user,
         'gameListingUrl': '/gameList',
         'imageUrl' : "" if user is None else model.userPicture(user.email()),
         'loginUrl' : users.create_login_url(self.request.uri),
         'logoutUrl' : users.create_logout_url(self.request.uri),
         'loggedin' : (not user is None),
         'creategameUrl' : '/creategame',
     }
             
     path = os.path.join(os.path.dirname(__file__), 'templates/main.xhtml')
     self.response.out.write(template.render(path, template_params))
Пример #4
0
    def get(self):
        user = users.get_current_user()

        template_params = {
            'user': user,
            'gameListingUrl': '/gameList',
            'imageUrl':
            "" if user is None else model.userPicture(user.email()),
            'loginUrl': users.create_login_url(self.request.uri),
            'logoutUrl': users.create_logout_url(self.request.uri),
            'loggedin': (not user is None),
            'creategameUrl': '/creategame',
        }

        path = os.path.join(os.path.dirname(__file__), 'templates/main.xhtml')
        self.response.out.write(template.render(path, template_params))