]> git.phdru.name Git - bookmarks_db.git/commitdiff
Minor refactoring: reorder return values
authorOleg Broytman <phd@phdru.name>
Fri, 4 Jul 2014 20:39:25 +0000 (00:39 +0400)
committerOleg Broytman <phd@phdru.name>
Fri, 4 Jul 2014 20:39:25 +0000 (00:39 +0400)
Robots/bkmk_robot_base.py
Robots/bkmk_rurllib.py

index 057fceff7d7370c1cff4a34957118f42ee955665..dce593310c1a1461749f189ca49dbd3b269f06cb 100644 (file)
@@ -61,12 +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, error = self.get(bookmark, url, True)
+         error, headers, content = self.get(bookmark, url, True)
 
          if error:
              bookmark.error = error
-
-         if content is None:
              return 1
 
          size = 0
@@ -145,7 +143,7 @@ class robot_base(Robot):
                         _icon_url = icon_url
                         for i in range(8):
                            try:
-                              icon_headers, icon_data, error = self.get(bookmark, _icon_url)
+                              error, icon_headers, icon_data = self.get(bookmark, _icon_url)
                            except RedirectException, e:
                               _icon_url = e.url
                               self.log("   redirect to : %s" % _icon_url)
index 839e37316197d10a51b8812e5bca874e7f00738f..d9908b83292ab92fcfd107710446555cd3aab712 100644 (file)
@@ -91,7 +91,7 @@ class robot_urllib(robot_base):
          content = infile.read()
          infile.close()
 
-         return headers, content, None
+         return None, headers, content
 
       except IOError, msg:
          if (msg[0] == "http error") and (msg[1] == -1):
@@ -102,7 +102,7 @@ class robot_urllib(robot_base):
             error = get_error(msg)
             self.log('   Error: %s' % error)
 
-         return None, None, error
+         return error, None, None
 
    def get_ftp_welcome(self):
       global ftpcache_key