]> git.phdru.name Git - bookmarks_db.git/commitdiff
Do not assign icon errors to bookmark.error
authorOleg Broytman <phd@phdru.name>
Sat, 31 May 2014 23:26:40 +0000 (03:26 +0400)
committerOleg Broytman <phd@phdru.name>
Sat, 31 May 2014 23:26:40 +0000 (03:26 +0400)
Robots/bkmk_robot_base.py
Robots/bkmk_rurllib.py

index 63fd73e08e9e71b0423d44eca0b8c9a1db671725..6226328388c78e75e4cedf90604760a84517be40 100644 (file)
@@ -61,7 +61,10 @@ class robot_base(Robot):
          url_path, url_tag  = urllib.splittag(url_path)
 
          url = "%s://%s%s" % (url_type, url_host, url_path)
-         headers, content = self.urlretrieve(bookmark, url, True)
+         headers, content, error = self.urlretrieve(bookmark, url, True)
+
+         if error:
+             bookmark.error = error
 
          if content is None:
              return 1
@@ -142,7 +145,7 @@ class robot_base(Robot):
                         _icon_url = icon_url
                         for i in range(8):
                            try:
-                              icon_headers, icon_data = self.urlretrieve(bookmark, _icon_url)
+                              icon_headers, icon_data, error = self.urlretrieve(bookmark, _icon_url)
                            except RedirectException, e:
                               _icon_url = e.url
                               self.log("   redirect to : %s" % _icon_url)
index f0a614e3799e1ccae9750bd57fbbf5c4f99ccd90..a2174a814108fec99206202933f83521a9562360 100644 (file)
@@ -87,17 +87,18 @@ class robot_urllib(robot_base):
          content = infile.read()
          infile.close()
 
-         return headers, content
+         return headers, content, None
 
       except IOError, msg:
          if (msg[0] == "http error") and (msg[1] == -1):
+            error = None
             bookmark.no_error = "The server did not return any header - it is not an error, actually"
             self.log('   no headers: %s' % bookmark.no_error)
          else:
-            bookmark.error = get_error(msg)
-            self.log('   Error: %s' % bookmark.error)
+            error = get_error(msg)
+            self.log('   Error: %s' % error)
 
-         return None, None
+         return None, None, error
 
    def get_ftp_welcome(self):
       global ftpcache_key