#NEWLINE# @ viewer . view ( 'show_postlist_by_tag_index' ) #NEWLINE# @ viewer . view ( 'show_postlist_by_tag' ) #NEWLINE# def show_postlist_by_tag( tag , page = 1 ) : #NEWLINE# #INDENT# 'Render a post list filtered by tag' #NEWLINE# tagobj = Tag . query . filter ( ( Tag . value == tag ) ) . first ( ) #NEWLINE# if ( tagobj is None ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# #UNINDENT# p_filter = Post . tags . contains ( tagobj ) #NEWLINE# p_order = Post . pubdate . desc ( ) #NEWLINE# posts = get_posts ( p_filter , p_order ) #NEWLINE# title = ( 'Posts tagged "%s"' % page ) #NEWLINE# paginator = Paginator ( posts , app . config [ 'ENTRIES_PER_PAGE' ] , page , 'show_postlist_by_tag' , tag = tag ) #NEWLINE# return viewer . render ( 'post_list.html' , posts = posts , paginator = paginator , title = title )