Changeset 416:1c821283556a in documentViewer for MpdlXmlTextServer.py


Ignore:
Timestamp:
Dec 23, 2010, 4:45:55 PM (13 years ago)
Author:
casties
Branch:
default
Message:

new getInfoFromPage to read multiple parameters at once

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MpdlXmlTextServer.py

    r415 r416  
    225225            # figureEntries
    226226            pagedivs = dom.xpath("//div[@class='countFigureEntries']")
    227             docinfo['figureEntries'] = getTextFromNode(pagedivs[0])
     227            s = getTextFromNode(pagedivs[0])
     228            try:
     229                docinfo['figureEntries'] = int(s)
     230            except:
     231                docinfo['figureEntries'] = 0
    228232            # tocEntries
    229233            pagedivs = dom.xpath("//div[@class='countTocEntries']")
    230             docinfo['tocEntries'] = getTextFromNode(pagedivs[0])
     234            s = getTextFromNode(pagedivs[0])
     235            try:
     236                docinfo['tocEntries'] = int(s)
     237            except:
     238                docinfo['tocEntries'] = 0
    231239            # allPlaces
    232240            pagedivs = dom.xpath("//div[@class='countPlaces']")
    233             docinfo['allPlaces']= getTextFromNode(pagedivs[0])
     241            s = getTextFromNode(pagedivs[0])
     242            try:
     243                docinfo['allPlaces'] = int(s)
     244            except:
     245                docinfo['allPlaces'] = 0
    234246
    235247        return docinfo
Note: See TracChangeset for help on using the changeset viewer.