From d84565b4dd67f4385058d391fef9ae0d45b4c90d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Metin?= Date: Wed, 5 Oct 2005 08:52:27 +0000 Subject: [PATCH] =?UTF-8?q?-=20use=20YESEXPR=20and=20NOEXPR=20for=20in=20c?= =?UTF-8?q?onfirm=20-=20a=20workaround=20for=20string=20conversion=20in=20?= =?UTF-8?q?python=20exceptions=20(thanks=20G=C3=BCrer)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/api.py | 6 +++--- pisi/cli/__init__.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pisi/api.py b/pisi/api.py index 8491496e..9ef18df6 100644 --- a/pisi/api.py +++ b/pisi/api.py @@ -92,9 +92,9 @@ def install(packages): #FIXME: As Gurer warns, something's fishy with this exception proc. except InstallError, e: - print type(e) - ctx.ui.error(str(e)) - ctx.ui.error("InstallError:") #%s" % str(e)) + # FIXME: This is a workaround for __str__ conversion used in + # Python exceptions + ctx.ui.error(e.args[0]) except packagedb.Error, e: ctx.ui.error("PackageDBError: (%s)" % str(e)) diff --git a/pisi/cli/__init__.py b/pisi/cli/__init__.py index 1c95bf97..61eff490 100644 --- a/pisi/cli/__init__.py +++ b/pisi/cli/__init__.py @@ -92,9 +92,9 @@ class CLI(UI): while True: prompt = msg + colorize(_('(yes/no)'), 'red') s = raw_input(prompt.encode('utf-8')) - if s.startswith(_('y').encode('utf-8')) or s.startswith(_('Y').encode('utf-8')): + if s[0] in locale.nl_langinfo(locale.YESEXPR): return True - if s.startswith(_('n').encode('utf-8')) or s.startswith(_('N').encode('utf-8')): + elif s[0] in locale.nl_langinfo(locale.NOEXPR): return False def display_progress(self, pd):