[PATCH 1/2] Use constants for protocol's order instead of magic numbers

Vratislav Podzimek vpodzime at redhat.com
Thu May 2 12:12:58 UTC 2013


This fixes a bug that was caused by changing the order of the protocols and not
changing the magic number values accordingly. The result was that "http://" was
not prepended to the URL when selected.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/source.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index e9ecc7c..d37b10a 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -30,6 +30,7 @@ log = logging.getLogger("anaconda")
 
 import os.path
 
+# pylint: disable-msg=E0611
 from gi.repository import AnacondaWidgets, GLib, Gtk
 
 from pyanaconda.flags import flags
@@ -349,10 +350,10 @@ class SourceSpoke(NormalSpoke):
             # revisited.
             if self._ftp_active() and not url.startswith("ftp://"):
                 url = "ftp://" + url
-            elif self._protocolComboBox.get_active() == 1 and not url.startswith("http://"):
+            elif self._protocolComboBox.get_active() == PROTOCOL_HTTP and not url.startswith("http://"):
                 url = "http://" + url
                 mirrorlist = self._mirrorlistCheckbox.get_active()
-            elif self._protocolComboBox.get_active() == 2 and not url.startswith("https://"):
+            elif self._protocolComboBox.get_active() == PROTOCOL_HTTPS and not url.startswith("https://"):
                 url = "https://" + url
                 mirrorlist = self._mirrorlistCheckbox.get_active()
 
-- 
1.7.11.7



More information about the anaconda-patches mailing list