From 1009bf6f448174746762e05ab99cf4b413d4bd27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 5 Oct 2005 09:03:22 +0000 Subject: [PATCH] - YESEXPR is a regexp (shame on me...) - apply the workaround to other except block... --- pisi/api.py | 3 ++- pisi/cli/__init__.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 9ef18df6..0b99711e 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -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: diff --git a/pisi/cli/__init__.py b/pisi/cli/__init__.py index 61eff490..d34b16e9 100644 --- a/pisi/cli/__init__.py +++ b/pisi/cli/__init__.py @@ -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'])