Changeset 514:c55e376be01b in documentViewer
- Timestamp:
- Feb 28, 2012, 6:46:37 PM (13 years ago)
- Branch:
- default
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
SrvTxtUtils.py
r490 r514 12 12 13 13 14 srvTxtUtilsVersion = "1. 3"14 srvTxtUtilsVersion = "1.4" 15 15 16 16 def getInt(number, default=0): … … 27 27 except: 28 28 return default 29 30 def unicodify(s): 31 """decode str (utf-8 or latin-1 representation) into unicode object""" 32 if not s: 33 return u"" 34 if isinstance(s, str): 35 try: 36 return s.decode('utf-8') 37 except: 38 return s.decode('latin-1') 39 else: 40 return s 41 42 def utf8ify(s): 43 """encode unicode object or string into byte string in utf-8 representation. 44 assumes string objects to be utf-8""" 45 if not s: 46 return "" 47 if isinstance(s, str): 48 return s 49 else: 50 return s.encode('utf-8') 29 51 30 52 def getText(node, recursive=0): -
documentViewer.py
r513 r514 18 18 import string 19 19 20 from SrvTxtUtils import getInt, getText, getHttpData, refreshingImageFileIndexHtml20 from SrvTxtUtils import getInt, utf8ify, getText, getHttpData, refreshingImageFileIndexHtml 21 21 22 22 def serializeNode(node, encoding="utf-8"): … … 382 382 urlParams = self.getParams(param=param, val=val, params=params, duplicates=duplicates) 383 383 # quote values and assemble into query string (not escaping '/') 384 ps = paramSep.join(["%s=%s"%(k, urllib.quote_plus(unicode(v),'/')) for (k, v) in urlParams.items()])384 ps = paramSep.join(["%s=%s"%(k, urllib.quote_plus(utf8ify(v), '/')) for (k, v) in urlParams.items()]) 385 385 if baseUrl is None: 386 386 baseUrl = self.getDocumentViewerURL() … … 397 397 """returns info about the document as XML""" 398 398 if not self.digilibBaseUrl: 399 self.digilibBaseUrl = self.findDigilibUrl() or "http:// nausikaa.mpiwg-berlin.mpg.de/digitallibrary"399 self.digilibBaseUrl = self.findDigilibUrl() or "http://digilib.mpiwg-berlin.mpg.de/digitallibrary" 400 400 401 401 docinfo = self.getDocinfo(mode=mode,url=url) -
version.txt
r498 r514 1 DocumentViewer 2.0 a1 DocumentViewer 2.0b -
zpt/viewer_images.zpt
r512 r514 6 6 numPages docinfo/numPages | nothing; dlBaseUrl docinfo/digilibBaseUrl | nothing;"> 7 7 <head> 8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 9 9 <title 10 10 tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" /> -
zpt/viewer_text.zpt
r512 r514 8 8 numPages docinfo/numPages | nothing;"> 9 9 <head> 10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 11 11 <title 12 12 tal:content="python:docinfo.get('creator',' ') + ' - ' + docinfo.get('title',' ')" />
Note: See TracChangeset
for help on using the changeset viewer.