#NEWLINE# def range( self ) : #NEWLINE# #INDENT# 'Return a list of page numbers to show in the paginator.' #NEWLINE# ( page , total , span ) = ( self . page , self . num_pages , self . span ) #NEWLINE# if ( total < self . max ) : #NEWLINE# #INDENT# ( lower , upper ) = ( 0 , total ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( page < ( span + 1 ) ) : #NEWLINE# #INDENT# ( lower , upper ) = ( 0 , ( span * 2 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( page > ( total - span ) ) : #NEWLINE# #INDENT# ( lower , upper ) = ( ( total - ( span * 2 ) ) , total ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( lower , upper ) = ( ( page - span ) , ( ( page + span ) - 1 ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return range ( max ( ( lower + 1 ) , 1 ) , ( min ( total , upper ) + 1 ) )