소스 검색

Supress any kind of exception if version check fails

 * Problems with checking the version on the server side
   should not affect end users
Oz N Tiram 8 년 전
부모
커밋
3e1736007d
1개의 변경된 파일10개의 추가작업 그리고 7개의 파일을 삭제
  1. 10 7
      pwman/ui/cli.py

+ 10 - 7
pwman/ui/cli.py

@@ -95,13 +95,16 @@ def get_ui_platform(platform):  # pragma: no cover
 
 def is_latest_version():  # pragma: no cover
     """check current version againt latest version"""
-    conn = http.client.HTTPConnection("pwman.tiram.it", timeout=0.5)
-    conn.request("GET", "/")
-    r = conn.getresponse()
-    data = r.read()  # This will return entire content.
-    if data.decode().split(".") > version.split("."):
-        return False
-    else:
+    try:
+        conn = http.client.HTTPConnection("pwman.tiram.it", timeout=0.5)
+        conn.request("GET", "/")
+        r = conn.getresponse()
+        data = r.read()  # This will return entire content.
+        if data.decode().split(".") > version.split("."):
+            return False
+        else:
+            return True
+    except Exception:
         return True