Mercurial > hg > documentViewer
comparison MpiwgXmlTextServer.py @ 613:c57d80a649ea
CLOSED - # 281: List of thumbnails verschluckt Seite, wenn odd-scan-position gesetzt ist
https://it-dev.mpiwg-berlin.mpg.de/tracs/mpdl-project-software/ticket/281
author | casties |
---|---|
date | Thu, 17 Oct 2013 16:25:39 +0200 |
parents | 0488cd12355b |
children | 4a75a760def2 |
comparison
equal
deleted
inserted
replaced
612:a79e4e4b3e37 | 613:c57d80a649ea |
---|---|
9 import urlparse | 9 import urlparse |
10 import base64 | 10 import base64 |
11 | 11 |
12 from datetime import datetime | 12 from datetime import datetime |
13 | 13 |
14 from SrvTxtUtils import getInt, getText, getHttpData | 14 from SrvTxtUtils import getInt, getText, getHttpData, serialize |
15 | 15 |
16 # mapping of fields in the output of /mpiwg-mpdl-cms-web/query/GetDocInfo to documentViewer docinfo | 16 # mapping of fields in the output of /mpiwg-mpdl-cms-web/query/GetDocInfo to documentViewer docinfo |
17 textinfoFieldMap = { | 17 textinfoFieldMap = { |
18 'countPages' : 'numTextPages', | 18 'countPages' : 'numTextPages', |
19 'countFigures' : 'numFigureEntries', | 19 'countFigures' : 'numFigureEntries', |
20 'countNotesHandwritten' : 'numHandwritten', | 20 'countNotesHandwritten' : 'numHandwritten', |
21 'countNotes' : 'numNotes', | 21 'countNotes' : 'numNotes', |
22 'countPlaces' : 'numPlaces', | 22 'countPlaces' : 'numPlaces', |
23 'countTocEntries' : 'numTocEntries' | 23 'countTocEntries' : 'numTocEntries' |
24 } | 24 } |
25 | |
26 def serialize(node): | |
27 """returns a string containing an XML snippet of node""" | |
28 s = ET.tostring(node, 'UTF-8') | |
29 # snip off XML declaration | |
30 if s.startswith('<?xml'): | |
31 i = s.find('?>') | |
32 return s[i+3:] | |
33 | |
34 return s | |
35 | 25 |
36 | 26 |
37 class MpiwgXmlTextServer(SimpleItem): | 27 class MpiwgXmlTextServer(SimpleItem): |
38 """TextServer implementation for MPIWG-XML server""" | 28 """TextServer implementation for MPIWG-XML server""" |
39 meta_type="MPIWG-XML TextServer" | 29 meta_type="MPIWG-XML TextServer" |