#NEWLINE# def request_boolean( self , msg , default_option = None ) : #NEWLINE# #INDENT# 'Request user to input a boolean' #NEWLINE# ret = None #NEWLINE# while ( ret is None ) : #NEWLINE# #INDENT# if ( default_option is True ) : #NEWLINE# #INDENT# s = self . request_string ( ( '%s (YES/no)' % msg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( default_option is False ) : #NEWLINE# #INDENT# s = self . request_string ( ( '%s (NO/yes)' % msg ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# s = self . request_string ( ( '%s (yes/no)' % msg ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( default_option is not None ) and ( s == '' ) ) : #NEWLINE# #INDENT# return default_option #NEWLINE# #UNINDENT# if ( s . lower ( ) in [ 'yes' , 'y' ] ) : #NEWLINE# #INDENT# ret = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( s . lower ( ) in [ 'no' , 'n' ] ) : #NEWLINE# #INDENT# ret = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . out . error ( ( '%s is not a valid answer' % s ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ret