- YESEXPR is a regexp (shame on me...)

- apply the workaround to other except block...
This commit is contained in:
Barış Metin
2005-10-05 09:03:22 +00:00
parent 1051e1ae2b
commit 1009bf6f44
2 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -97,7 +97,8 @@ def install(packages):
ctx.ui.error(e.args[0])
except packagedb.Error, e:
ctx.ui.error("PackageDBError: (%s)" % str(e))
# FIXME: same workaround...
ctx.ui.error("PackageDBError: (%s)" % e.args[0])
ctx.ui.error(_("Package is not installable."))
#except Exception, e:
+6 -3
View File
@@ -90,13 +90,16 @@ class CLI(UI):
if ctx.config.options and ctx.config.options.yes_all:
return True
while True:
import re
yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))
prompt = msg + colorize(_('(yes/no)'), 'red')
s = raw_input(prompt.encode('utf-8'))
if s[0] in locale.nl_langinfo(locale.YESEXPR):
if yesexpr.search(s):
return True
elif s[0] in locale.nl_langinfo(locale.NOEXPR):
return False
return False
def display_progress(self, pd):
out = '\r%-30.30s %3d%% %12.2f %s' % \
(pd['filename'], pd['percent'], pd['rate'], pd['symbol'])