[master 2/2] Fix bad warning message when user set illegal IP

jkonecny12 installerbot-noreply at redhat.com
Wed May 20 07:52:12 UTC 2015


From: Jiri Konecny <jkonecny at redhat.com>

Before this fix when user set bad IP address the reaction was:

"You have provided an invalid user name: %s\n"
"Tip: Keep your user name shorter than 32 characters and do not use
spaces.\n"

Now it is:
"Bad format of the IP address"
---
 pyanaconda/ui/tui/spokes/__init__.py | 8 ++++++--
 pyanaconda/ui/tui/spokes/network.py  | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/tui/spokes/__init__.py b/pyanaconda/ui/tui/spokes/__init__.py
index c65e285..394c928 100644
--- a/pyanaconda/ui/tui/spokes/__init__.py
+++ b/pyanaconda/ui/tui/spokes/__init__.py
@@ -110,6 +110,7 @@ def __init__(self, app, data, storage, payload, instclass, policy_name=""):
         NormalTUISpoke.__init__(self, app, data, storage, payload, instclass)
         self.value = None
         self.policy = None
+        self.wrong_input_message = None
 
         # Configure the password policy, if available. Otherwise use defaults.
         self.policy = self.data.anaconda.pwpolicy.get_policy(policy_name)
@@ -183,8 +184,11 @@ def input(self, entry, key):
             self.close()
             return True
         else:
-            print(_("You have provided an invalid user name: %s\n"
-                    "Tip: Keep your user name shorter than 32 characters and do not use spaces.\n") % key)
+            if self.wrong_input_message:
+                print(self.wrong_input_message)
+            else:
+                print(_("You have provided an invalid user name: %s\n"
+                        "Tip: Keep your user name shorter than 32 characters and do not use spaces.\n") % key)
             return NormalTUISpoke.input(self, entry, key)
 
 class OneShotEditTUIDialog(EditTUIDialog):
diff --git a/pyanaconda/ui/tui/spokes/network.py b/pyanaconda/ui/tui/spokes/network.py
index b7d4e37..4f66e41 100644
--- a/pyanaconda/ui/tui/spokes/network.py
+++ b/pyanaconda/ui/tui/spokes/network.py
@@ -295,6 +295,7 @@ def __init__(self, app, data, storage, payload, instclass, ndata):
         if self.args.noipv6:
             self.args.ipv6 = "ignore"
         self.args._apply = False
+        self.dialog.wrong_input_message = _("Bad format of the IP address")
 
     def refresh(self, args=None):
         """ Refresh window. """


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/98173662550d8fcda19e9980a0f688644104da47


More information about the anaconda-patches mailing list