Ejemplo n.º 1
0
 def render(self, postinfo, userinfo):
     rating = False
     if userinfo:
         rating = MRating.get_rating(postinfo.uid, userinfo.uid)
     if rating:
         pass
     else:
         rating = postinfo.rating
     return self.render_string(
         'modules/widget/star_rating.html',
         unescape=tornado.escape.xhtml_unescape,
         postinfo=postinfo,
         userinfo=userinfo,
         rating=rating,
     )
Ejemplo n.º 2
0
 def render(self, *args, **kwargs):
     postinfo = args[0]
     userinfo = args[1]
     rating = False
     if userinfo:
         rating = MRating.get_rating(postinfo.uid, userinfo.uid)
     if rating:
         pass
     else:
         rating = postinfo.rating
     return self.render_string(
         'modules/widget/star_rating.html',
         postinfo=postinfo,
         userinfo=userinfo,
         rating=rating,
     )
Ejemplo n.º 3
0
 def test_get_rating(self):
     self.add_message()
     rat=MRating.get_rating(self.post_id, self.userid)
     self.tearDown()
     assert rat==float(self.rating)