コード例 #1
0
def show_tag(name):
    links = Link.get_public_by_tag(name)
    title = 'Links for Tag - "%s"' % name
    return render_template('link_index.html',
                           pageoptions=get_default_data(),
                           user=None,
                           curr_user=current_user,
                           links=links,
                           section_title=title,
                           page_title=title)
コード例 #2
0
def show_all_user_tagged(name, username):
    user = User.get_by_username(username)
    links = Link.get_public_by_tag(name, user.userid)
    title = 'Links for tag "%s" by %s' % (name, user.username)
    return render_template('link_index.html',
                           pageoptions=get_default_data(),
                           user=user,
                           curr_user=current_user,
                           links=links,
                           section_title=title,
                           page_title=title)
コード例 #3
0
 def test_get_public_by_tag_nonexistent_hasuser(self):
     result = Link.get_public_by_tag('this does not exist', 1)
     self.assertEqual(len(result), 0)
コード例 #4
0
 def test_get_public_by_tag_exists_hasuser(self):
     result = Link.get_public_by_tag('test1', 1)
     self.assertEqual(len(result), 2)