def ask_bool(self, question, default=True):
        """ Ask the user for Y)es / N)o / Q)uit.

            If "Q" ist entered, this method will exit with RC=3.
            Else, the user's choice is returned.

            Note that the options --non-interactive and --defaults
            also influence the outcome.
        """
        if self.script.options.yes:
            return True
        elif self.script.options.dry_run or not self.script.options.interactive:
            return default
        else:
            # Let the user decide
            choice = '*'
            while choice not in "YNAQ":
                choice = raw_input("%s? [%s)es, %s)o, a)ll yes, q)uit]: " % (
                    fmt.to_console(question), "yY"[int(default)], "Nn"[int(default)],
                ))
                choice = choice[:1].upper() or "NY"[int(default)]

            if choice == 'Q':
                self.quit()
            if choice == 'A':
                self.script.options.yes = True
                choice = 'Y'

            return choice == 'Y'
def ask_bool ( self , question , default = True ) : if self . script . options . yes : return True elif self . script . options . dry_run or not self . script . options . interactive : return default else : choice = '*' while choice not in "YNAQ" : choice = raw_input ( "%s? [%s)es, %s)o, a)ll yes, q)uit]: " % ( fmt . to_console ( question ) , "yY" [ int ( default ) ] , "Nn" [ int ( default ) ] , ) ) choice = choice [ : 1 ] . upper ( ) or "NY" [ int ( default ) ] if choice == 'Q' : self . quit ( ) if choice == 'A' : self . script . options . yes = True choice = 'Y' return choice == 'Y'
Ask the user for Y)es / N)o / Q)uit.

            If "Q" ist entered, this method will exit with RC=3.
            Else, the user's choice is returned.

            Note that the options --non-interactive and --defaults
            also influence the outcome.