[Yum-devel] [PATCH] Add downloadonly to the userconfirm for downloads.
Zdenek Pavlas
zpavlas at redhat.com
Tue Apr 23 08:08:01 UTC 2013
> + elif uc == 'downloadonly':
> + self.conf.downloadonly = True
> + self.verbose_logger.info(_('Will exit after downloads are complete'))
It's a good idea UI-wise, and enabling --downloadonly at this point should be safe.
ACK.
> + aui = (dui[0], dui[1], dui[2], yui[0], yui[1], nui[0], nui[1])
That's "aui = dui + yui + nui".
Maybe, instead of adding 2 wrappers around self.userconfirm(), we should just add
few optional args, and call it with third=(u'd', _("download"), _("downloadonly")).
--- a/output.py
+++ b/output.py
@@ -960,7 +960,7 @@ class YumOutput:
- def userconfirm(self):
+ def userconfirm(self, prompt=_('Is this ok [y/N]: '), third=()):
"""Get a yes or no from the user, and default to No
:return: True if the user selects yes, and False if the user
@@ -968,10 +968,10 @@ class YumOutput:
"""
yui = (to_unicode(_('y')), to_unicode(_('yes')))
nui = (to_unicode(_('n')), to_unicode(_('no')))
- aui = (yui[0], yui[1], nui[0], nui[1])
+ aui = yui + nui + third
while True:
try:
- choice = raw_input(_('Is this ok [y/N]: '))
+ choice = raw_input(prompt)
except UnicodeEncodeError:
raise
except UnicodeDecodeError:
@@ -990,6 +990,8 @@ class YumOutput:
break
if len(choice) == 0 or choice not in yui:
+ if choice not in nui and choice in third:
+ return third[0]
return False
else:
return True
More information about the Yum-devel
mailing list