[PATCH jk-tui 1/2] Add some validation to the text rootpw spoke

Jesse Keating jkeating at redhat.com
Wed Aug 22 19:56:03 UTC 2012


On 08/22/2012 08:30 AM, Chris Lumens wrote:
>> +            except pwquality.PWQError as (e, msg):
>> +                # This translation may not work.  Taken from textw/userauth_text
>> +                # where it actually did the substitution /inside/ the _() call.
>> +                print(_("You have provided a weak password: %s\n\n"
>> +                        "Would you like to continue with this password?") % msg)
>> +                # This yesno thing feels like it should be a library provided
>> +                # utility, instead of written out here.  Move it somewhere
>> +                # better someday.  jlk
>> +                yesno = raw_input(_("Please enter y for yes or n for no: "))
>> +                if yesno in [_("y"), _("Y"), _("yes"), _("YES"), _("Yes")]:
>> +                    return True
>> +                else:
>> +                    return False
>
> As long as msg is translated in the pwquality module (that's with _(),
> not N_()) then this will work fine.
>
> If it's not, you'll need to use the actual gettext function and provide
> it with a catalog to look up msg in.
>

Do we know how well this worked in the textw and gui interface?  In that 
code it uses:

_("You have provided a weak password: %s\n\n"
   "Would you like to continue with this password?" % msg)

since there are only a few outputs from pwquality (and I don't think 
they're translated), I wonder if our translation table just has entries 
for the entire set with each potential output.  I just don't know how to 
look that up.

I'm inclined to duplicate what was there before, instead of what I have 
above.

-- 
Jesse Keating
Fedora -- FreedomĀ² is a feature!


More information about the anaconda-patches mailing list