#NEWLINE# def get_contents( self , long_slug ) : #NEWLINE# #INDENT# now = datetime . now ( ) #NEWLINE# path = long_slug . split ( '/' ) #NEWLINE# mpath = ',' . join ( path ) #NEWLINE# mpath = ',{0},' . format ( mpath ) #NEWLINE# channel = Channel . objects . get_or_404 ( mpath = mpath , published = True ) #NEWLINE# if ( not channel . include_in_rss ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# #UNINDENT# self . channel = channel #NEWLINE# base_filters = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# filters = { #NEWLINE# #INDENT# 'published' : True , #NEWLINE# 'available_at__lte' : now , #NEWLINE# #UNINDENT# } #NEWLINE# if ( not channel . is_homepage ) : #NEWLINE# #INDENT# base_filters [ '__raw__' ] = { #NEWLINE# #INDENT# 'mpath' : { #NEWLINE# #INDENT# '$regex' : '^{0}' . format ( mpath ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# filters . update ( channel . get_content_filters ( ) ) #NEWLINE# contents = Content . objects ( ** base_filters ) . filter ( ** filters ) #NEWLINE# if current_app . config . get ( 'PAGINATION_ENABLED' , True ) : #NEWLINE# #INDENT# pagination_arg = current_app . config . get ( 'PAGINATION_ARG' , 'page' ) #NEWLINE# page = request . args . get ( pagination_arg , 1 ) #NEWLINE# per_page = ( channel . per_page or current_app . config . get ( 'PAGINATION_PER_PAGE' , 10 ) ) #NEWLINE# contents = contents . paginate ( page = int ( page ) , per_page = per_page ) #NEWLINE# #UNINDENT# return contents