[master/rhel7-branch] Fix PWQError issue when checking TUI passwords. (#1066988)

Anne Mulhern amulhern at redhat.com
Mon Sep 29 13:39:09 UTC 2014





----- Original Message -----
> From: "Samantha N. Bueno" <sbueno+anaconda at redhat.com>
> To: "anaconda patch review" <anaconda-patches at lists.fedorahosted.org>
> Sent: Monday, September 29, 2014 9:17:58 AM
> Subject: Re: [master/rhel7-branch] Fix PWQError issue when checking TUI	passwords.	(#1066988)
> 
> Let this one slip under the radar a bit....
> 
> On Fri, Sep 19, 2014 at 08:37:44AM -0400, Anne Mulhern wrote:
> > 
> > Probably would be just as good with:
> > 
> > error = None
> > try:
> > 
> >     error_msg = ...
> >     if error_msg:
> >         ...
> > 
> >     strength = checkPassword(pw)
> >     if strength < 50:
> >         error = "The password you have provided is weak."
> > except PWQError as e:
> >     error = e[1]
> > finally:
> >     if error:
> >         error = _("You have provided...%s") % error
> >         error += ("\n...")
> >         etc....
> 
> Right then, here's the new patch--
> 
> diff --git a/pyanaconda/ui/tui/spokes/__init__.py
> b/pyanaconda/ui/tui/spokes/__init__.py
> index 3b48a2a..76bed4b 100644
> --- a/pyanaconda/ui/tui/spokes/__init__.py
> +++ b/pyanaconda/ui/tui/spokes/__init__.py
> @@ -124,14 +124,17 @@ class EditTUIDialog(NormalTUISpoke):
>                      return None
>                  strength = checkPassword(pw)
>                  if strength < 50:
> -                    raise PWQError("The password you have provided is
> weak.")
> +                    error = _("The password you have provided is weak")
>              except PWQError as e:
> -                error = _("You have provided a weak password: %s. ") % e[1]
> -                error += _("\nWould you like to use it anyway?")
> -                question_window = YesNoDialog(self._app, error)
> -                self._app.switch_screen_modal(question_window)
> -                if not question_window.answer:
> -                    return None
> +                error = e[1]
> +            finally:
> +                if error:
> +                    error = _("You have provided a weak password: %s.  ") %
> error
> +                    error += _("\nWould you like to use it anyway?")
> +                    question_window = YesNoDialog(self._app, error)
> +                    self._app.switch_screen_modal(question_window)
> +                    if not question_window.answer:
> +                        return None
>  
>              self.value = cryptPassword(pw)
>              return None
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

I believe that this will work as required.

- mulhern


More information about the anaconda-patches mailing list