#NEWLINE# def validate_number( self , number ) : #NEWLINE# #INDENT# '\n        Validates the given 1-based page number.\n        ' #NEWLINE# try : #NEWLINE# #INDENT# number = int ( number ) #NEWLINE# #UNINDENT# except ( TypeError , ValueError ) : #NEWLINE# #INDENT# raise PageNotAnInteger ( 'That page number is not an integer' ) #NEWLINE# #UNINDENT# if ( number < 1 ) : #NEWLINE# #INDENT# raise EmptyPage ( 'That page number is less than 1' ) #NEWLINE# #UNINDENT# if ( number > self . num_pages ) : #NEWLINE# #INDENT# if ( ( number == 1 ) and number . allow_empty_first_page ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise EmptyPage ( 'That page contains no results' ) #NEWLINE# #UNINDENT# #UNINDENT# return number