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, )
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, )
def test_get_rating(self): self.add_message() rat=MRating.get_rating(self.post_id, self.userid) self.tearDown() assert rat==float(self.rating)