Ejemplo n.º 1
0
 def render_str(self, template, **kw):
     kw['user'] = self.user
     kw['registered_users'] = Count.getAllRegisteredUsers()
     kw['comments'] = Count.getAllFrontComments(
     ) + Count.getAllSnakeComments()
     t = jinja_env.get_template(template)
     return t.render(kw)
Ejemplo n.º 2
0
    def get(self):
        #Get the latest count
        Count.setAllFrontComments(FrontComment.all().count())
        Count.setAllSnakeComments(SnakeComment.all().count())
        Count.setAllRegisteredUsers(User.all().count())
        logged_out = self.request.get('logged_out')
        logged_in = self.request.get('logged_in')
        registered = self.request.get('registered')
        all_comments = self.request.get('allComments')

        if all_comments == 'True':
            comments = GqlQuery("SELECT * FROM FrontComment ORDER BY created DESC")
        else:
            comments = GqlQuery("SELECT * FROM FrontComment ORDER BY created DESC LIMIT 4")

        if self.format == 'html':
            self.render('front.html', frontComments=comments, logged_in=logged_in, logged_out=logged_out,
                        registered=registered)
        else:
            return self.render_json([p.as_dict() for p in comments])
Ejemplo n.º 3
0
 def render_str(self, template, **kw):
     kw['user'] = self.user
     kw['registered_users'] = Count.getAllRegisteredUsers()
     kw['comments'] = Count.getAllFrontComments() + Count.getAllSnakeComments()
     t = jinja_env.get_template(template)
     return t.render(kw)
Ejemplo n.º 4
0
 def get(self):
     count = Count(google_clicks=0, snake_clicks=0, bubble_clicks=1)
     count.put()
     self.render('bubbleshooter.html')