#NEWLINE# def prompt( self , text ) : #NEWLINE# #INDENT# "\n        Write the given text as a prompt to the console output, then read a\n        result from the console input.\n\n        @return: a L{Deferred} which fires with L{True} when the user answers\n        'yes' and L{False} when the user answers 'no'.  It may errback if there\n        were any I/O errors.\n        " #NEWLINE# d = defer . succeed ( None ) #NEWLINE# def body( ignored ) : #NEWLINE# #INDENT# f = self . opener ( ) #NEWLINE# f . write ( text ) #NEWLINE# while True : #NEWLINE# #INDENT# answer = f . readline ( ) . strip ( ) . lower ( ) #NEWLINE# if ( answer == 'yes' ) : #NEWLINE# #INDENT# f . close ( ) #NEWLINE# return True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( answer == 'no' ) : #NEWLINE# #INDENT# f . close ( ) #NEWLINE# return False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# f . write ( "Please type 'yes' or 'no': " ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return d . addCallback ( self )