diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | plugins/python/welcome/version.py | 23 |
2 files changed, 19 insertions, 9 deletions
@@ -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 |