changeset 43:f3bc59cf64d9

fixed some problems with bad index.meta files (text-tools mode)
author casties
date Tue, 18 Jul 2006 18:59:57 +0200
parents fbc7258e4b5c
children 4b519fc6a5a0
files documentViewer.py version.txt
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/documentViewer.py	Fri Jul 14 18:22:36 2006 +0200
+++ b/documentViewer.py	Tue Jul 18 18:59:57 2006 +0200
@@ -284,9 +284,14 @@
        if dom is None:
            dom = self.getIndexMeta(url)
        
+       archivePath = None
+       archiveName = None
+
        archiveNames=dom.xpath("//resource/name")
        if archiveNames and (len(archiveNames)>0):
            archiveName=getTextFromNode(archiveNames[0])
+       else:
+           zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/name missing in: %s"%(url))
        
        archivePaths=dom.xpath("//resource/archive-path")
        if archivePaths and (len(archivePaths)>0):
@@ -294,10 +299,17 @@
            # clean up archive path
            if archivePath[0] != '/':
                archivePath = '/' + archivePath
-           if not archivePath.endswith(archiveName):
+           if archiveName and (not archivePath.endswith(archiveName)):
                archivePath += "/" + archiveName
        else:
-           archivePath=None
+           # try to get archive-path from url
+           zLOG.LOG("documentViewer (getdocinfofromtexttool)", zLOG.WARNING,"resource/archive-path missing in: %s"%(url))
+           if (not url.startswith('http')):
+               archivePath = url.replace('index.meta', '')
+               
+       if archivePath is None:
+           # we balk without archive-path
+           raise IOError("Missing archive-path (for text-tool) in %s"%(url))
        
        imageDirs=dom.xpath("//texttool/image")
        if imageDirs and (len(imageDirs)>0):
--- a/version.txt	Fri Jul 14 18:22:36 2006 +0200
+++ b/version.txt	Tue Jul 18 18:59:57 2006 +0200
@@ -1,1 +1,1 @@
-DocumentViewer 0.2.6
\ No newline at end of file
+DocumentViewer 0.3.1
\ No newline at end of file