← Back to team overview

wifixers team mailing list archive

[Merge] lp:~14-jeevan/wifix/Bug_681883 into lp:wifix

 

Jeevan has proposed merging lp:~14-jeevan/wifix/Bug_681883 into lp:wifix.

Requested reviews:
  Sam Dieck (sam-dieck)

For more details, see:
https://code.launchpad.net/~14-jeevan/wifix/Bug_681883/+merge/240029

Solves Bug#681883

Added a function which checks if the system is connected to internet or not. If there's no internet connection it displays a message saying "Please check your internet connection" and exits the application gracefully.
-- 
https://code.launchpad.net/~14-jeevan/wifix/Bug_681883/+merge/240029
Your team Wifixers is subscribed to branch lp:wifix.
=== modified file 'platforms.py'
--- platforms.py	2010-08-21 03:48:27 +0000
+++ platforms.py	2014-10-29 17:06:17 +0000
@@ -30,9 +30,17 @@
 import sys
 import urllib
 import time
+import urllib2
 
 import messages
 
+def internet_on():
+    try:
+        response = urllib2.urlopen("http://wifix.sourceforge.net:80",timeout=1)
+        return True
+    except urllib2.URLError as err: pass
+    return False
+
 class __Platform:
     """
     Provides an interface for OS-dependent calls.
@@ -161,6 +169,12 @@
 
         # Call PHP page to retrieve available drivers
         pm.start("Querying database", "Fetching driver information from database")
+
+        if not internet_on():
+            self.message("Please check your internet connection")
+            pm.stop()
+            sys.exit()
+
         try:
             die = False
             conn = httplib.HTTPConnection("wifix.sourceforge.net:80")