Hi! --- clientStuff.py 5 Nov 2002 22:25:37 -0000 1.52 +++ clientStuff.py 8 Nov 2002 00:24:13 -0000 @@ -455,10 +455,10 @@ if len(choice) == 0: return 1 else: - if choice[0] != 'y' and choice[0] != 'Y': - return 1 - else: + if choice[0] in ['y', 'Y']: return 0 + else: + return 1 but I have a question: Why "userconfirm" on success confirm return 0? yummain.py code fragment: if clientStuff.userconfirm(): errorlog(1, _('Exiting on user command.')) sys.exit(1) Example of "reverse logic": "if user confirm then exit". At this case, best name for this method 'exit_confirm'. Final version of usercofirm() can looks like: def userconfirm(): """gets a yes or no from the user, defaults to No""" choice = raw_input(_('Is this ok [y/N]: ')) try: return choice[0] in ['y', 'Y'] except: return 0 Another question: userconfirm() used only in yummain.py, I think, his declaration must be moved to yummain.py final yummain diff: ==== cut === --- yummain.py 4 Nov 2002 21:01:13 -0000 1.30 +++ yummain.py 8 Nov 2002 00:39:22 -0000 1.31 @@ -232,10 +232,9 @@ (i_list, u_list, e_list, ud_list, ed_list) = clientStuff.actionslists(tsInfo) clientStuff.printactions(i_list, u_list, e_list, ud_list, ed_list) - if conf.assumeyes == 0: - if clientStuff.userconfirm(): - errorlog(1, _('Exiting on user command.')) - sys.exit(1) + if (not conf.assumeyes) or (not userconfirm()): + errorlog(1, _('Exiting on user command.')) + sys.exit(1) if conf.uid == 0: dbfin = clientStuff.openrpmdb(1, '/') @@ -272,6 +271,15 @@ log(2, _('Transaction(s) Complete')) sys.exit(0) + + +def userconfirm(): + """gets a yes or no from the user, defaults to No""" + choice = raw_input(_('Is this ok [y/N]: ')) + try: + return choice[0] in ['y', 'Y'] + except: + return 0 def usage(): ==== cut === -- Bor.