[tuxdroid-svn] r5076 - in software_suite_v3/smart-core/smart-server/trunk: . util/misc
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-07-08 06:36:59
|
Author: remi
Date: 2009-07-08 08:36:37 +0200 (Wed, 08 Jul 2009)
New Revision: 5076
Modified:
software_suite_v3/smart-core/smart-server/trunk/TDSAutoUpdater.py
software_suite_v3/smart-core/smart-server/trunk/util/misc/URLTools.py
Log:
* Wait that the connection to Internet is enabled before to start the check of the updates.
Modified: software_suite_v3/smart-core/smart-server/trunk/TDSAutoUpdater.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/TDSAutoUpdater.py 2009-07-07 20:21:00 UTC (rev 5075)
+++ software_suite_v3/smart-core/smart-server/trunk/TDSAutoUpdater.py 2009-07-08 06:36:37 UTC (rev 5076)
@@ -15,6 +15,7 @@
import os
import threading
import subprocess
+import time
from TDSConfiguration import *
@@ -153,6 +154,9 @@
def __updateFromTheNet(self):
"""
"""
+ # Wait for connection to internet enabled
+ while not URLTools.URLCheckConnection():
+ time.sleep(1.0)
# Download conf files
for partName in PART_NAMES:
confUrl = UPDATES_PARTS[partName][PART_CONF_SRC_URL]
Modified: software_suite_v3/smart-core/smart-server/trunk/util/misc/URLTools.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/util/misc/URLTools.py 2009-07-07 20:21:00 UTC (rev 5075)
+++ software_suite_v3/smart-core/smart-server/trunk/util/misc/URLTools.py 2009-07-08 06:36:37 UTC (rev 5076)
@@ -23,8 +23,9 @@
# ------------------------------------------------------------------------------
# Check the internet connection.
# ------------------------------------------------------------------------------
-def URLCheckConnection():
+def URLCheckConnection(urlToCheck = "www.kysoh.com"):
"""Check the internet connection.
+ @param urlToCheck: Check connection with this url.
@return: The internet connection state.
"""
# Save the old default connection timeout
@@ -35,7 +36,7 @@
result = True
# Attempt to connect to the google web site
try:
- f = urllib2.urlopen("http://www.google.com")
+ f = urllib2.urlopen(urlToCheck)
f.close()
except urllib2.HTTPError, exc:
result = False
|