def render(self, *args, **kwargs): ''' fun(user_name, catid) fun(user_name, catid, num) fun(user_name, catid, num, glyph = val1) ''' # user_name = args[0] # cat_id = args[1] # num = args[2] # glyph = kwargs['glyph'] if 'glyph' in kwargs else '' user_name = kwargs.get('user_name', args[0]) cat_id = kwargs.get('cat_id', args[1]) num = kwargs.get('num', args[2] if len(args) > 2 else 6) glyph = kwargs.get('glyph', '') all_cats = MUsage.query_recent_by_cat(user_name, cat_id, num).naive() kwd = { 'glyph': glyph } return self.render_string('modules/info/list_user_equation_no_catalog.html', recs=all_cats, kwd=kwd)
def test_query_recent_by_cat(self): self.add_message() self.add_usage() aa = MUsage.query_recent_by_cat(self.userid, self.tag_id, 8) tf = False for i in aa: if i.post_id == self.postid: assert i.uid == self.uid tf = True assert tf self.tearDown()
def render(self, *args, **kwargs): user_name = args[0] cat_id = args[1] num = args[2] glyph = kwargs['glyph'] if 'glyph' in kwargs else '' all_cats = MUsage.query_recent_by_cat(user_name, cat_id, num).naive() kwd = {'glyph': glyph} return self.render_string( 'modules/info/list_user_equation_no_catalog.html', recs=all_cats, kwd=kwd)
def test_query_recent_by_cat(self): MUsage.query_recent_by_cat(self.userid, '0100', 8) assert True