Ejemplo n.º 1
0
    def get(self):
        user = users.get_current_user()
        if not user:
            self.redirect("/")

        player = doo.getplayerbyuser(user)
        if not player:
            player = doo.makeplayer(user.nickname(), user=user)
            
        toplayer = doo.getplayer(self.request.get('param'))
        if not toplayer:
            self.error(404)
        
        if toplayer.solid:
            return
            
        hasmoney = player.money >= doo.getmessageprice()
        
        messageprice = doo.getmessagepricedisplay()
        
        template_values = {
            'player': player,
            'toplayer': toplayer,
            'hasmoney': hasmoney,
            'messageprice': messageprice,
            }

        if player.mobile:
            templatefile = 'm_sendmessage.html'
        else:
            templatefile = 'sendmessage.html'
        path = os.path.join(os.path.dirname(__file__), templatefile)
        self.response.out.write(template.render(path, template_values))
Ejemplo n.º 2
0
    def get(self):
        user = users.get_current_user()
        if not user:
            self.redirect("/")

        player = doo.getplayerbyuser(user)
        if not player:
            player = doo.makeplayer(user.nickname(), user=user)
            
        messageprice = doo.getmessagepricedisplay()
        
        template_values = {
            'player': player,
            'messageprice': messageprice,
            }

        if player.mobile:
            templatefile = 'm_inbox.html'
        else:
            templatefile = 'inbox.html'
        path = os.path.join(os.path.dirname(__file__), templatefile)
        self.response.out.write(template.render(path, template_values))