def yes_no_question(question): """Asks `question` as a yes/no question. Returns True, if the user answered yes, otherwise False.""" promt = _('%(question)s [%(yes)s,%(no)s] ') % {'question': question, 'yes': _('y'), 'no': _('n')} return (raw_input(promt).lower() == _('y'))
def yes_no_question(question): """Asks `question` as a yes/no question. Returns True, if the user answered yes, otherwise False.""" promt = _('%(question)s [%(yes)s,%(no)s] ') % { 'question': question, 'yes': _('y'), 'no': _('n') } return (raw_input(promt).lower() == _('y'))
def get_input(self, field, oldvalue, new): """Gets a value from command line input. :param field: The fieldname of the edited field :param oldvalue: The old value of the field :param new: Whether the entry is new""" if new: prompt = '%s: ' % phonebook.translate_field(field) else: prompt = '%s [%s]: ' prompt = prompt % (phonebook.translate_field(field), oldvalue) return raw_input(prompt)
def get_input(self, field, oldvalue, new): """Gets a value from command line input. :param field: The fieldname of the edited field :param oldvalue: The old value of the field :param new: Whether the entry is new""" if not new: self.oldvalue = oldvalue else: self.oldvalue = None prompt = u'%s: ' % phonebook.translate_field(field) return raw_input(prompt)