WebBrowser/Download/DownloadManager.py

changeset 6093
5ed91fe54bc9
parent 6091
7b989321d74c
child 6118
da9e08920e7c
--- a/WebBrowser/Download/DownloadManager.py	Thu Jan 25 17:47:09 2018 +0100
+++ b/WebBrowser/Download/DownloadManager.py	Thu Jan 25 18:50:49 2018 +0100
@@ -173,23 +173,26 @@
             return
         
         # Safe Browsing
-        threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url)
-        if threatLists:
-            threatMessages = WebBrowserWindow.safeBrowsingManager()\
-                .getThreatMessages(threatLists)
-            res = E5MessageBox.warning(
-                WebBrowserWindow.getWindow(),
-                self.tr("Suspicuous URL detected"),
-                self.tr("<p>The URL <b>{0}</b> was found in the Safe Browsing"
-                        " database.</p>{1}").format(url.toString(),
-                                                    "".join(threatMessages)),
-                E5MessageBox.StandardButtons(
-                    E5MessageBox.Abort |
-                    E5MessageBox.Ignore),
-                E5MessageBox.Abort)
-            if res == E5MessageBox.Abort:
-                downloadItem.cancel()
-                return
+        from WebBrowser.SafeBrowsing.SafeBrowsingManager import \
+            SafeBrowsingManager
+        if SafeBrowsingManager.isEnabled():
+            threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url)
+            if threatLists:
+                threatMessages = WebBrowserWindow.safeBrowsingManager()\
+                    .getThreatMessages(threatLists)
+                res = E5MessageBox.warning(
+                    WebBrowserWindow.getWindow(),
+                    self.tr("Suspicuous URL detected"),
+                    self.tr("<p>The URL <b>{0}</b> was found in the Safe"
+                            " Browsing database.</p>{1}").format(
+                        url.toString(), "".join(threatMessages)),
+                    E5MessageBox.StandardButtons(
+                        E5MessageBox.Abort |
+                        E5MessageBox.Ignore),
+                    E5MessageBox.Abort)
+                if res == E5MessageBox.Abort:
+                    downloadItem.cancel()
+                    return
         
         from .DownloadItem import DownloadItem
         itm = DownloadItem(downloadItem, parent=self)

eric ide

mercurial