WebBrowser/SafeBrowsing/SafeBrowsingDialog.py

changeset 6234
fb1f9e681848
parent 6233
a64b986abb54
child 6645
ad476851d7e0
equal deleted inserted replaced
6233:a64b986abb54 6234:fb1f9e681848
291 # http://malware.testing.google.test/testing/malware/* 291 # http://malware.testing.google.test/testing/malware/*
292 # http://ianfette.org 292 # http://ianfette.org
293 # 293 #
294 urlStr = self.urlEdit.text() 294 urlStr = self.urlEdit.text()
295 url = QUrl.fromUserInput(urlStr) 295 url = QUrl.fromUserInput(urlStr)
296 threatLists = self.__manager.lookupUrl(url) 296 threatLists, error = self.__manager.lookupUrl(url)
297 # TODO: handle threatLists being None (indicating a lookup error) 297
298 298 if error:
299 if threatLists: 299 E5MessageBox.warning(
300 self,
301 self.tr("Check URL"),
302 self.tr("<p>The Google Safe Browsing Server reported an"
303 " error.</p><p>{0}</p>").format(error)
304 )
305 elif threatLists:
300 threatMessages = self.__manager.getThreatMessages(threatLists) 306 threatMessages = self.__manager.getThreatMessages(threatLists)
301 E5MessageBox.warning( 307 E5MessageBox.warning(
302 self, 308 self,
303 self.tr("Check URL"), 309 self.tr("Check URL"),
304 self.tr("<p>The URL <b>{0}</b> was found in the Safe Browsing" 310 self.tr("<p>The URL <b>{0}</b> was found in the Safe"
305 " Database.</p>{1}").format(urlStr, 311 " Browsing Database.</p>{1}").format(
306 "".join(threatMessages)) 312 urlStr, "".join(threatMessages))
307 ) 313 )
308 else: 314 else:
309 E5MessageBox.information( 315 E5MessageBox.information(
310 self, 316 self,
311 self.tr("Check URL"), 317 self.tr("Check URL"),
312 self.tr("<p>The URL <b>{0}</b> was not found in the Safe" 318 self.tr("<p>The URL <b>{0}</b> was not found in the Safe"
313 " Browsing Database and may be considered safe.</p>") 319 " Browsing Database and may be considered safe."
320 "</p>")
314 .format(urlStr) 321 .format(urlStr)
315 ) 322 )
316 323
317 @pyqtSlot() 324 @pyqtSlot()
318 def on_saveButton_clicked(self): 325 def on_saveButton_clicked(self):

eric ide

mercurial