changeset 409:f7d73ea4b38b

quick fix for broken texturlpath
author casties
date Thu, 25 Nov 2010 10:03:50 +0100
parents 4e84c53e49b3
children 13dd83f46f6f
files MpdlXmlTextServer.py documentViewer.py
diffstat 2 files changed, 15 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MpdlXmlTextServer.py	Wed Nov 24 17:01:26 2010 +0100
+++ b/MpdlXmlTextServer.py	Thu Nov 25 10:03:50 2010 +0100
@@ -143,7 +143,10 @@
     def getGisPlaces(self, docinfo=None, pageinfo=None):
         """ Show all Gis Places of whole Page"""
         xpath='//place'
-        docpath = docinfo['textURLPath'] 
+        docpath = docinfo.get('textURLPath',None)
+        if not docpath:
+            return None
+
         url = docinfo['url']
         selfurl = self.absolute_url()
         pn = pageinfo['current']
@@ -198,7 +201,10 @@
            
     def getOrigPages (self, docinfo=None, pageinfo=None):
         """Show original page """
-        docpath = docinfo['textURLPath'] 
+        docpath = docinfo.get('textURLPath',None)
+        if not docpath:
+            return None
+
         logging.debug ("docinfo['textURLPath']=%s"%(docinfo['textURLPath']))
         #url = docinfo['url']
         selfurl = self.absolute_url()
--- a/documentViewer.py	Wed Nov 24 17:01:26 2010 +0100
+++ b/documentViewer.py	Thu Nov 25 10:03:50 2010 +0100
@@ -283,7 +283,7 @@
         pt = getattr(self.template, 'thumbs_main_rss')
         
         if viewMode=="auto": # automodus gewaehlt
-            if docinfo.has_key("textURL") or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert
+            if docinfo.has_key("textURL") or docinfo.get('textURLPath',None): #texturl gesetzt und textViewer konfiguriert
                 viewMode="text"
             else:
                 viewMode="images"
@@ -319,7 +319,7 @@
             docinfo = self.getToc(mode=tocMode, docinfo=docinfo)
             
         if viewMode=="auto": # automodus gewaehlt
-            if docinfo.has_key('textURL') or docinfo.has_key('textURLPath'): #texturl gesetzt und textViewer konfiguriert
+            if docinfo.has_key('textURL') or docinfo.get('textURLPath',None): #texturl gesetzt und textViewer konfiguriert
                 viewMode="text_dict"
             else:
                 viewMode="images"
@@ -796,7 +796,11 @@
         else:
             logging.error("documentViewer (getdocinfo) unknown mode: %s!"%mode)
             raise ValueError("Unknown mode %s! Has to be one of 'texttool','imagepath','filepath'."%(mode))
-                        
+                
+        # FIXME: fake texturlpath 
+        if not docinfo.has_key('textURLPath'):
+            docinfo['textURLPath'] = None
+        
         logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo)
         #logging.debug("documentViewer (getdocinfo) docinfo: %s"%)
         self.REQUEST.SESSION['docinfo'] = docinfo