Changeset 435:94baa8dbc7e8 in documentViewer
- Timestamp:
- Mar 1, 2011, 2:53:15 PM (14 years ago)
- Branch:
- default
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
MpdlXmlTextServer.py
r434 r435 130 130 return serializeNode(pagenode) 131 131 return "no text here" 132 133 132 134 133 def getGisPlaces(self, docinfo=None, pageinfo=None): … … 202 201 pagexml = self.getServerData("page-fragment.xql",textParam) 203 202 dom = Parse(pagexml) 204 205 203 #original Pages 206 204 pagedivs = dom.xpath("//div[@class='pageNumberOrig']") … … 208 206 if len(pagedivs)>0: 209 207 docinfo['pageNumberOrig']= getTextFromNode(pagedivs[0]) 210 #logging.debug("ORIGINAL PAGES: %s"%(docinfo['pageNumberOrig']))211 208 212 209 #original Pages Norm … … 215 212 if len(pagedivs)>0: 216 213 docinfo['pageNumberOrigNorm']= getTextFromNode(pagedivs[0]) 217 #logging.debug("ORIGINAL PAGES: %s"%(docinfo['pageNumberOrigNorm']))218 219 214 220 215 #figureEntries … … 227 222 try: 228 223 docinfo['countFigureEntries'] = int(s) 229 #logging.debug("FIGURE ENTRIES: %s"%(s))230 224 except: 231 225 docinfo['countFigureEntries'] = 0 … … 234 228 try: 235 229 docinfo['countFigureEntries'] = int(s1) 236 #logging.debug("FIGURE ENTRIES: %s"%(s1))237 230 except: 238 231 docinfo['countFigureEntries'] = 0 … … 246 239 try: 247 240 docinfo['countPlaces'] = int(s) 248 #logging.debug("PLACES HERE: %s"%(s))249 241 except: 250 242 docinfo['countPlaces'] = 0 … … 259 251 try: 260 252 docinfo['countTocEntries'] = int(s) 261 #logging.debug("TEXT ENTRIES: %s"%(s))262 253 except: 263 254 docinfo['countTocEntries'] = 0 … … 266 257 try: 267 258 docinfo['countTocEntries'] = int(s1) 268 #logging.debug("TEXT ENTRIES: %s"%(s1))269 259 except: 270 260 docinfo['countTocEntries'] = 0 … … 302 292 if mode == "text": 303 293 # first div contains text 304 #mode = viewMode305 294 pagedivs = dom.xpath("/div") 306 295 if len(pagedivs) > 0: … … 407 396 numdivs = pagedom.xpath("//div[@class='queryResultHits']") 408 397 tocSearch = int(getTextFromNode(numdivs[0])) 409 #logging.debug("documentViewer (gettoc) tocSearch: %s"%(tocSearch))410 398 tc=int((tocSearch/10)+1) 411 #logging.debug("documentViewer (gettoc) tc: %s"%(tc))412 399 return tc 413 400 414 401 def getToc(self, mode="text", docinfo=None): 415 402 """loads table of contents and stores in docinfo""" 416 #logging.debug("documentViewer (gettoc) mode: %s"%(mode))417 403 if mode == "none": 418 404 return docinfo … … 466 452 page = data.replace('page-fragment.xql?document=%s'%str(path),'%s?url=%s&viewMode=%s&tocMode=%s&tocPN=%s&optionToggle=1'%(selfurl,url, viewMode, tocMode, tocPN)) 467 453 text = page.replace('mode=image','mode=texttool') 468 #logging.debug("documentViewer (characterNormalization) characterNormalization: %s"%(characterNormalization))469 #logging.debug("TEXT %s"%(text))470 454 return text 471 455 -
documentViewer.py
r434 r435 44 44 return rc 45 45 46 def serializeNode(node, encoding= 'utf-8'):46 def serializeNode(node, encoding="utf-8"): 47 47 """returns a string containing node as XML""" 48 buf = cStringIO.StringIO() 49 Ft.Xml.Domlette.Print(node, stream=buf, encoding=encoding) 50 s = buf.getvalue() 51 buf.close() 48 stream = cStringIO.StringIO() 49 logging.debug("BUF: %s"%(stream)) 50 Ft.Xml.Domlette.PrettyPrint(node, stream=stream, encoding=encoding) 51 s = stream.getvalue() 52 logging.debug("BUF: %s"%(s)) 53 stream.close() 52 54 return s 53 55 … … 162 164 #return None 163 165 164 165 166 166 ## 167 167 ## documentViewer class … … 899 899 pageinfo['tocPageSize'] = self.REQUEST.get('tocPageSize', '30') 900 900 pageinfo['queryPageSize'] =self.REQUEST.get('queryPageSize', '10') 901 pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') 902 901 pageinfo['tocPN'] = self.REQUEST.get('tocPN', '1') 903 902 toc = int (pageinfo['tocPN']) 904 903 pageinfo['textPages'] =int (toc) 905 906 907 904 908 905 if 'tocSize_%s'%tocMode in docinfo:
Note: See TracChangeset
for help on using the changeset viewer.