Mercurial > hg > documentViewer
changeset 569:be21250420be
MpdlXmlTextServer more resilient to non-existing doc-info.xql
author | casties |
---|---|
date | Fri, 12 Oct 2012 15:34:37 +0200 |
parents | 694935574177 |
children | 61d53ccbdd70 |
files | MpdlXmlTextServer.py version.txt |
diffstat | 2 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/MpdlXmlTextServer.py Thu Oct 11 18:27:14 2012 +0200 +++ b/MpdlXmlTextServer.py Fri Oct 12 15:34:37 2012 +0200 @@ -107,15 +107,20 @@ if docpath is None: logging.error("getTextInfo: no textURLPath!") return docinfo - - # we need to set a result set size - pagesize = 10000 - pn = 1 - # fetch docinfo - pagexml = self.getServerData("doc-info.xql","document=%s&info=%s&pageSize=%s&pn=%s"%(docpath,mode,pagesize,pn)) - dom = ET.fromstring(pagexml) - # all info in tag <document> - doc = dom.find("document") + + try: + # we need to set a result set size + pagesize = 10000 + pn = 1 + # fetch docinfo + pagexml = self.getServerData("doc-info.xql","document=%s&info=%s&pageSize=%s&pn=%s"%(docpath,mode,pagesize,pn)) + dom = ET.fromstring(pagexml) + # all info in tag <document> + doc = dom.find("document") + except Exception, e: + logging.error("getTextInfo: Error getting data: %s"%e) + return docinfo + if doc is None: logging.error("getTextInfo: unable to find document-tag!") else: