[PATCH] Fix pylint/translation issues from the pwpolicy patches.

Chris Lumens clumens at redhat.com
Mon Mar 23 14:20:15 UTC 2015


---
 po/POTFILES.in                       | 1 +
 pyanaconda/constants.py              | 2 +-
 pyanaconda/pwpolicy.py               | 2 +-
 pyanaconda/ui/gui/spokes/password.py | 2 +-
 pyanaconda/ui/gui/spokes/user.py     | 2 +-
 pyanaconda/ui/tui/spokes/__init__.py | 6 ++++--
 6 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/po/POTFILES.in b/po/POTFILES.in
index e3ab399..6ba4fac 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -16,6 +16,7 @@ pyanaconda/iutil.py
 pyanaconda/kickstart.py
 pyanaconda/network.py
 pyanaconda/product.py
+pyanaconda/pwpolicy.py
 pyanaconda/regexes.py
 pyanaconda/rescue.py
 pyanaconda/storage_utils.py
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index 0f7d1e8..8523f0e 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -139,7 +139,7 @@ PASSWORD_EMPTY_ERROR = N_("The password is empty.")
 PASSWORD_CONFIRM_ERROR_GUI = N_("The passwords do not match.")
 PASSWORD_CONFIRM_ERROR_TUI = N_("The passwords you entered were different.  Please try again.")
 PASSWORD_WEAK = N_("The password you have provided is weak. %s")
-PASSWORD_WEAK_WITH_ERROR = N_("The password you have provided is weak: %s. %s")
+PASSWORD_WEAK_WITH_ERROR = N_("The password you have provided is weak: %s.")
 PASSWORD_WEAK_CONFIRM = N_("You have provided a weak password. Press Done again to use anyway.")
 PASSWORD_WEAK_CONFIRM_WITH_ERROR = N_("You have provided a weak password: %s. Press Done again to use anyway.")
 PASSWORD_ASCII = N_("The password you have provided contains non-ASCII characters. You may not be able to switch between keyboard layouts to login. Press Done to continue.")
diff --git a/pyanaconda/pwpolicy.py b/pyanaconda/pwpolicy.py
index c061e1a..1a4b238 100644
--- a/pyanaconda/pwpolicy.py
+++ b/pyanaconda/pwpolicy.py
@@ -120,7 +120,7 @@ class F22_PwPolicy(KickstartCommand):
 
         # Check for duplicates in the data list.
         if pd in self.dataList():
-            warnings.warn(_("A %s with the name %s has already been defined.") % ("pwpolicy", pd.name))
+            warnings.warn(_("A %(command)s with the name %(policyName)s has already been defined.") % {"command": "pwpolicy", "policyName": pd.name})
 
         return pd
 
diff --git a/pyanaconda/ui/gui/spokes/password.py b/pyanaconda/ui/gui/spokes/password.py
index 6a73b19..1eeb426 100644
--- a/pyanaconda/ui/gui/spokes/password.py
+++ b/pyanaconda/ui/gui/spokes/password.py
@@ -272,7 +272,7 @@ class PasswordSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler)
                     done_msg = _(PASSWORD_DONE_TWICE)
 
                 if self._pwq_error:
-                    return _(PASSWORD_WEAK_WITH_ERROR) % (self._pwq_error, done_msg)
+                    return _(PASSWORD_WEAK_WITH_ERROR) % self._pwq_error + " " + done_msg
                 else:
                     return _(PASSWORD_WEAK) % done_msg
         else:
diff --git a/pyanaconda/ui/gui/spokes/user.py b/pyanaconda/ui/gui/spokes/user.py
index 9b647af..947e281 100644
--- a/pyanaconda/ui/gui/spokes/user.py
+++ b/pyanaconda/ui/gui/spokes/user.py
@@ -593,7 +593,7 @@ class UserSpoke(FirstbootSpokeMixIn, NormalSpoke, GUISpokeInputCheckHandler):
                     done_msg = _(PASSWORD_DONE_TWICE)
 
                 if self._pwq_error:
-                    return _(PASSWORD_WEAK_WITH_ERROR) % (self._pwq_error, done_msg)
+                    return _(PASSWORD_WEAK_WITH_ERROR) % self._pwq_error + " " + done_msg
                 else:
                     return _(PASSWORD_WEAK) % done_msg
         else:
diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index 868fdcc..7718502 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -109,10 +109,12 @@ class EditTUIDialog(NormalTUISpoke):
 
         NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
         self.value = None
+        self.policy = None
+        self.policy_name = policy_name
 
     def refresh(self, args=None):
         # Configure the password policy, if available. Otherwise use defaults.
-        self.policy = self.data.anaconda.pwpolicy.get_policy(policy_name)
+        self.policy = self.data.anaconda.pwpolicy.get_policy(self.policy_name)
         if not self.policy:
             self.policy = self.data.anaconda.PwPolicyData()
 
@@ -154,7 +156,7 @@ class EditTUIDialog(NormalTUISpoke):
                     done_msg = _("\nWould you like to use it anyway?")
 
                 if message:
-                    error = _(PASSWORD_WEAK_WITH_ERROR) % (message, done_msg)
+                    error = _(PASSWORD_WEAK_WITH_ERROR) % message + " " + done_msg
                 else:
                     error = _(PASSWORD_WEAK) % done_msg
 
-- 
2.2.2



More information about the anaconda-patches mailing list