comparison MpdlXmlTextServer.py @ 569:be21250420be

MpdlXmlTextServer more resilient to non-existing doc-info.xql
author casties
date Fri, 12 Oct 2012 15:34:37 +0200
parents 9255acc4518d
children 61d53ccbdd70
comparison
equal deleted inserted replaced
568:694935574177 569:be21250420be
105 105
106 docpath = docinfo.get('textURLPath', None) 106 docpath = docinfo.get('textURLPath', None)
107 if docpath is None: 107 if docpath is None:
108 logging.error("getTextInfo: no textURLPath!") 108 logging.error("getTextInfo: no textURLPath!")
109 return docinfo 109 return docinfo
110 110
111 # we need to set a result set size 111 try:
112 pagesize = 10000 112 # we need to set a result set size
113 pn = 1 113 pagesize = 10000
114 # fetch docinfo 114 pn = 1
115 pagexml = self.getServerData("doc-info.xql","document=%s&info=%s&pageSize=%s&pn=%s"%(docpath,mode,pagesize,pn)) 115 # fetch docinfo
116 dom = ET.fromstring(pagexml) 116 pagexml = self.getServerData("doc-info.xql","document=%s&info=%s&pageSize=%s&pn=%s"%(docpath,mode,pagesize,pn))
117 # all info in tag <document> 117 dom = ET.fromstring(pagexml)
118 doc = dom.find("document") 118 # all info in tag <document>
119 doc = dom.find("document")
120 except Exception, e:
121 logging.error("getTextInfo: Error getting data: %s"%e)
122 return docinfo
123
119 if doc is None: 124 if doc is None:
120 logging.error("getTextInfo: unable to find document-tag!") 125 logging.error("getTextInfo: unable to find document-tag!")
121 else: 126 else:
122 # go through all child elements 127 # go through all child elements
123 for tag in doc: 128 for tag in doc: