[master/rhel7-branch] Fix PWQError issues. (#1066988)

Samantha N. Bueno sbueno+anaconda at redhat.com
Mon Nov 24 18:53:24 UTC 2014


PWQError.message is empty, so call PWQError.args[index] instead to get
the actual error message and keep pylint happy.

Resolves: rhbz#1066988
---
 pyanaconda/ui/gui/spokes/lib/passphrase.py | 2 +-
 pyanaconda/ui/gui/spokes/password.py       | 4 ++--
 pyanaconda/ui/gui/spokes/user.py           | 4 ++--
 pyanaconda/ui/tui/spokes/__init__.py       | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/lib/passphrase.py b/pyanaconda/ui/gui/spokes/lib/passphrase.py
index 226159b..ef830d9 100644
--- a/pyanaconda/ui/gui/spokes/lib/passphrase.py
+++ b/pyanaconda/ui/gui/spokes/lib/passphrase.py
@@ -104,7 +104,7 @@ class PassphraseDialog(GUIObject):
         try:
             strength = self._pwq.check(passphrase, None, None)
         except pwquality.PWQError as e:
-            self._pwq_error = e.message
+            self._pwq_error = e.args[1]
 
         if strength < 50:
             val = 1
diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index 72ecc96..2cf390d 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -117,7 +117,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke):
             strength = checkPassword(self.pw.get_text())
             _pwq_error = None
         except PWQError as e:
-            _pwq_error = e.message
+            _pwq_error = e.args[1]
             strength = 0
 
         if strength < 50:
@@ -183,7 +183,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke):
                 pass
             else:
                 self._error = _("You have provided a weak password: %s. "
-                                " Press Done again to use anyway.") % e.message
+                                " Press Done again to use anyway.") % e.args[1]
                 self._oldweak = pw
                 return False
 
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index e40b413..813de24 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -351,7 +351,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
             strength = self._pwq.check(self.pw.get_text(), None, None)
             _pwq_error = None
         except pwquality.PWQError as e:
-            _pwq_error = e.message
+            _pwq_error = e.args[1]
             strength = 0
 
         if strength < 50:
@@ -426,7 +426,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke):
                 pass
             else:
                 self._error = _("You have provided a weak password: %s. "
-                                " Press Done again to use anyway.") % e.message
+                                " Press Done again to use anyway.") % e.args[1]
                 self._oldweak = pw
                 return False
 
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index 84f1c3c..bc3077a 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -126,7 +126,7 @@ class EditTUIDialog(NormalTUISpoke):
                 if strength < 50:
                     error = _("The password you have provided is weak")
             except PWQError as e:
-                error = e.message
+                error = e.args[1]
             if error:
                 error = _("You have provided a weak password: %s. ") % error
                 error += _("\nWould you like to use it anyway?")
-- 
1.9.3



More information about the anaconda-patches mailing list