]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/bkmk_rsimple.py
Fixed copyright dates.
[bookmarks_db.git] / Robots / bkmk_rsimple.py
index 7a96d256cd15bb571a3dc17bc34cab0ed16e47be..7a21c4fd1a1e72faf1397df7a853194dab30f696 100644 (file)
@@ -1,7 +1,7 @@
 """
    Simple, strightforward robot; guaranteed to has problems with timeouts :)
 
-   Written by BroytMann, Mar 2000 - Aug 2002. Copyright (C) 2000-2002 PhiloSoft Design
+   Written by BroytMann, Mar 2000 - Mar 2004. Copyright (C) 2000-2004 PhiloSoft Design
 """
 
 
@@ -17,7 +17,7 @@ class RedirectException(Exception):
 
 import string, os
 import time, urllib
-from m_lib.www.util import parse_time
+from m_lib.net.www.util import parse_time
 from m_lib.md5wrapper import md5wrapper
 
 
@@ -143,15 +143,18 @@ class robot_simple(Robot):
                      if self.log: self.log("   final title    : %s" % bookmark.real_title)
                      if parser.refresh:
                         refresh = parser.refresh
-                        try:
-                           timeout = int(refresh.split(';')[0])
-                        except (IndexError, ValueError):
-                           timeout = "ERROR"
                         try:
                            url = refresh.split('=', 1)[1]
                         except IndexError:
                            url = "self"
-                        raise RedirectException("html", "%s (%d sec)" % (url, timeout))
+                        try:
+                           timeout = int(refresh.split(';')[0])
+                        except (IndexError, ValueError):
+                           timeout = None
+                        if timeout is None:
+                           raise RedirectException("html", "Bad redirect to %s (%s)" % (url, refresh))
+                        else:
+                           raise RedirectException("html", "%s (%d sec)" % (url, timeout))
                except KeyError:
                   pass
 
@@ -180,7 +183,7 @@ class robot_simple(Robot):
    def finish_check_url(self, bookmark):
       # Calculate these attributes even in case of an error
       if os.path.exists(self.tempfname):
-         size = str(os.stat(self.tempfname).st_size)
+         size = str(os.path.getsize(self.tempfname))
          if size[-1] == 'L':
             size = size[:-1]
          bookmark.size = size