make update check more fault tolerant

This commit is contained in:
Damien Elmes 2009-06-23 01:49:11 +09:00
parent b12460f225
commit 0f3ad34af2

View file

@ -50,12 +50,13 @@ class LatestVersionFinder(QThread):
d = urllib.urlencode(d) d = urllib.urlencode(d)
try: try:
f = urllib2.urlopen(baseUrl + "getQtVersion", d) f = urllib2.urlopen(baseUrl + "getQtVersion", d)
except (urllib2.URLError, httplib.BadStatusLine): resp = f.read()
if not resp:
return
resp = simplejson.loads(resp)
except:
# behind proxy, corrupt message, etc
return return
resp = f.read()
if not resp:
return
resp = simplejson.loads(resp)
if resp['latestVersion'] > ankiqt.appVersion: if resp['latestVersion'] > ankiqt.appVersion:
self.emit(SIGNAL("newVerAvail"), resp) self.emit(SIGNAL("newVerAvail"), resp)
diff = resp['currentTime'] - time.time() diff = resp['currentTime'] - time.time()