- 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]) ctx.ui.error(e.args[0])
except packagedb.Error, e: 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.")) ctx.ui.error(_("Package is not installable."))
#except Exception, e: #except Exception, e:
+5 -2
View File
@@ -90,11 +90,14 @@ class CLI(UI):
if ctx.config.options and ctx.config.options.yes_all: if ctx.config.options and ctx.config.options.yes_all:
return True return True
while True: while True:
import re
yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))
prompt = msg + colorize(_('(yes/no)'), 'red') prompt = msg + colorize(_('(yes/no)'), 'red')
s = raw_input(prompt.encode('utf-8')) s = raw_input(prompt.encode('utf-8'))
if s[0] in locale.nl_langinfo(locale.YESEXPR): if yesexpr.search(s):
return True return True
elif s[0] in locale.nl_langinfo(locale.NOEXPR):
return False return False
def display_progress(self, pd): def display_progress(self, pd):