Index: MpdlXmlTextServer.py
===================================================================
--- MpdlXmlTextServer.py	(revision 414)
+++ MpdlXmlTextServer.py	(revision 415)
@@ -121,4 +121,5 @@
     def getNumTextPages (self, docinfo=None):
         """get list of pages from fulltext (texts without images) and put in docinfo"""
+        logging.debug("getNumTextPages")
         docpath = docinfo['textURLPath'] 
         selfurl = self.absolute_url()   
@@ -138,33 +139,11 @@
     def getTocEntries (self, docinfo=None):
         """ number of text entries"""
-        docpath = docinfo['textURLPath'] 
-        selfurl = self.absolute_url()
-        if 'tocEntries' in docinfo:
-            # allredy there
-            return docinfo['tocEntries']
-        if (docpath!=None):
-            text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
-            dom =Parse(text)
-            pagedivs = dom.xpath("//div[@class='countTocEntries']")
-            #logging.debug ("pagedivs=%s"%(pagedivs))
-            docinfo['tocEntries'] = getTextFromNode(pagedivs[0])
-            #tc = int (originalPage)
-            return docinfo['tocEntries']
+        self.getInfoFromPage(docinfo)
+        return docinfo['tocEntries']
             
     def getFigureEntries (self, docinfo=None):
         """ number of figure entries"""
-        docpath = docinfo['textURLPath'] 
-        selfurl = self.absolute_url()
-        if 'figureEntries' in docinfo:
-            # allredy there
-            return docinfo['figureEntries']
-        if (docpath!=None):   
-            text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
-            dom = Parse(text)
-            pagedivs = dom.xpath("//div[@class='countFigureEntries']")
-            #logging.debug ("pagedivs=%s"%(pagedivs))
-            docinfo['figureEntries'] = getTextFromNode(pagedivs[0])
-            #tc = int (docinfo['figureEntries'])
-            return docinfo['figureEntries']
+        self.getInfoFromPage(docinfo)
+        return docinfo['figureEntries']
                        
     def getGisPlaces(self, docinfo=None, pageinfo=None):
@@ -231,18 +210,29 @@
     def getAllPlaces (self, docinfo=None):
         """Show all Places if no places than 0"""
-        docpath = docinfo['textURLPath'] 
-        selfurl = self.absolute_url()
+        self.getInfoFromPage(docinfo)
+        return docinfo['allPlaces']
+
+    def getInfoFromPage(self, docinfo=None):
+        """ extract diverse info from page-fragment"""
+        docpath = docinfo['textURLPath']
         if 'allPlaces' in docinfo:
             # allredy there
-            return docinfo['allPlaces']
-        
-        text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
-        dom =Parse(text)
-        pagedivs = dom.xpath("//div[@class='countPlaces']")
-        logging.debug ("pagedivs=%s"%(pagedivs))
-        if len(pagedivs)>0:
+            return docinfo
+        
+        if (docpath is not None):   
+            text = self.getServerData("page-fragment.xql","document=%s"%(docinfo['textURLPath']))
+            dom = Parse(text)
+            # figureEntries
+            pagedivs = dom.xpath("//div[@class='countFigureEntries']")
+            docinfo['figureEntries'] = getTextFromNode(pagedivs[0])
+            # tocEntries
+            pagedivs = dom.xpath("//div[@class='countTocEntries']")
+            docinfo['tocEntries'] = getTextFromNode(pagedivs[0])
+            # allPlaces
+            pagedivs = dom.xpath("//div[@class='countPlaces']")
             docinfo['allPlaces']= getTextFromNode(pagedivs[0])
-            #logging.debug ("docinfo['allPlaces']=%s"%(docinfo['allPlaces']))
-            return docinfo['allPlaces']
+
+        return docinfo
+                       
            
     def getTextPage(self, mode="text", pn=1, docinfo=None, pageinfo=None, viewMode=None, tocMode=None, tocPN=None, characterNormalization="reg", highlightQuery=None, sn=None, optionToggle=None):
