[PATCH 4/4] New purely textual text interface

Vratislav Podzimek vpodzime at redhat.com
Mon Jan 21 10:58:27 UTC 2013


On Sat, 2013-01-19 at 19:52 -0800, Brian C. Lane wrote:
> On Tue, Jan 15, 2013 at 02:32:14PM +0100, Vratislav Podzimek wrote:
> > Since Anaconda supports purely textual (no curses-based) interface,
> > we need to provide it too.
> > 
> > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > ---
> >  meh/ui/text.py  | 156 ++++++++++++++++++++++++++++++++++++--------------------
> >  python-meh.spec |   6 +--
> >  2 files changed, 104 insertions(+), 58 deletions(-)
> > 
> > diff --git a/meh/ui/text.py b/meh/ui/text.py
> > index 3cdde37..28e3b7f 100644
> > --- a/meh/ui/text.py
> > +++ b/meh/ui/text.py
> > @@ -1,4 +1,4 @@
> > -# Copyright (C) 2009  Red Hat, Inc.
> > +# Copyright (C) 2009, 2012  Red Hat, Inc.
> 
> It is now 2013 :)
Good catch. :)

> 
> > +        # no answer means accepting the default (self._no_answer) and the answer
> > +        # is case insensitive
> > +        answer = answer.lower() or self._no_answer
> 
> Does .lower work ok with languages other than english?
And another one, you are right.

.lower doesn't work with encoded strings (utf-8 encoded unicode
strings). But this little trick:

    answer.decode("utf-8").lower().encode("utf-8")

works for both ascii strings and utf-8 encoded unicode strings
because .lower on unicode strings (as objects, i.e. not encoded) works
and both decode/encode do nothing on ascii strings.

The same goes for .upper used in the prompt. Both fixed locally.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list