changeset 39:1dd90aabd366

added retry when reading index meta from texter applet
author casties
date Tue, 13 Jun 2006 17:21:47 +0200
parents 025d3b6cba51
children 749ee5389892
files documentViewer.py version.txt
diffstat 2 files changed, 13 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Tue Jun 13 17:10:35 2006 +0200
+++ b/documentViewer.py	Tue Jun 13 17:21:47 2006 +0200
@@ -192,28 +192,30 @@
             
     def getIndexMeta(self, url):
         """returns dom of index.meta document at url"""
+        num_retries = 3
         dom = None
+        metaUrl = None
         if url.startswith("http://"):
             # real URL
-            try:
-                dom = NonvalidatingReader.parseUri(url)
-            except:
-                zLOG.LOG("documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
-                raise IOError("Unable to read index.meta from %s"%(url))
+            metaUrl = url
         else:
             # online path
             server=self.digilibBaseUrl+"/servlet/Texter?fn="
             metaUrl=server+url
             if not metaUrl.endswith("index.meta"):
                 metaUrl += "/index.meta"
+        
+        for n in range(num_retries):
             try:
-		# patch dirk encoding fehler treten dann nicht mehr auf
+                # patch dirk encoding fehler treten dann nicht mehr auf
                 # dom = NonvalidatingReader.parseUri(metaUrl)
-		txt=urllib.urlopen(metaUrl).read()
-		dom = Parse(txt)
+                txt=urllib.urlopen(metaUrl).read()
+                dom = Parse(txt)
             except:
-                zLOG.LOG("documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
-                raise IOError("Unable to read index meta from %s"%(metaUrl))
+                zLOG.LOG("ERROR documentViewer (getIndexMata)", zLOG.INFO,"%s (%s)"%sys.exc_info()[0:2])
+                
+        if dom is None:
+            raise IOError("Unable to read index meta from %s"%(url))
                  
         return dom
                         
--- a/version.txt	Tue Jun 13 17:10:35 2006 +0200
+++ b/version.txt	Tue Jun 13 17:21:47 2006 +0200
@@ -1,1 +1,1 @@
-DocumentViewer 0.2.4
\ No newline at end of file
+DocumentViewer 0.2.5
\ No newline at end of file