summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2015-12-29 17:36:17 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2015-12-29 17:36:17 (GMT)
commitecd6b51b126ee473c4942a53d1b17a76dd6b11c3 (patch)
treef0a434c4f6a8a4423b05ba2cac6cb724157e9b3f
parent5cad06b6a52e17d5649e0152c15745a96f7c0efa (diff)
Avoided to crash when the Internet is not reachable.
-rw-r--r--ChangeLog5
-rw-r--r--plugins/python/welcome/version.py23
2 files changed, 19 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index fcec4f1..eb972c0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
15-12-29 Cyrille Bagard <nocbos@gmail.com>
+ * plugins/python/welcome/version.py:
+ Avoid to crash when the Internet is not reachable.
+
+15-12-29 Cyrille Bagard <nocbos@gmail.com>
+
* src/arch/vmpa.c:
* src/arch/vmpa.h:
Detect intersections between two ranges.
diff --git a/plugins/python/welcome/version.py b/plugins/python/welcome/version.py
index c823d60..9bd4db2 100644
--- a/plugins/python/welcome/version.py
+++ b/plugins/python/welcome/version.py
@@ -76,19 +76,24 @@ To display the lastest available version, please install the <b>urllib3</b> pack
lastest = None
http = urllib3.PoolManager()
- request = http.request('GET', 'http://0xdeadc0de.fr/chrysalide/updates/versions')
+ try:
+ request = http.request('GET', 'http://0xdeadc0de.fr/chrysalide/updates/versions')
+ except urllib3.exceptions.MaxRetryError:
+ request = None
- html = request.data.decode('utf-8')
+ if request != None:
- request.release_conn()
+ html = request.data.decode('utf-8')
- available = html.split('\n')
+ request.release_conn()
- for a in available:
- desc = a.split('=')
- if desc[0] == category:
- lastest = desc[1]
- break
+ available = html.split('\n')
+
+ for a in available:
+ desc = a.split('=')
+ if desc[0] == category:
+ lastest = desc[1]
+ break
return lastest