Mercurial > hg > documentViewer
diff documentViewer.py @ 599:3b79ae4a23ca
normalize uri of annotated image.
author | casties |
---|---|
date | Mon, 19 Nov 2012 17:15:13 +0100 |
parents | da7daa783df4 |
children | ef1d0a1fc9fa |
line wrap: on
line diff
--- a/documentViewer.py Mon Nov 19 16:35:56 2012 +0100 +++ b/documentViewer.py Mon Nov 19 17:15:13 2012 +0100 @@ -535,7 +535,7 @@ # asssume index.meta in parent dir docUrl = getParentPath(url) metaDom = self.metadataService.getDomFromPathOrUrl(docUrl) - docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) + docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) elif mode=="filepath": # url points to image file, index.meta optional @@ -613,13 +613,13 @@ # image path if mode != 'texttool': # override image path from texttool with url parameter TODO: how about mode=auto? - docinfo['imagePath'] = url.replace('/mpiwg/online/', '', 1) + docinfo['imagePath'] = url.replace('/mpiwg/online', '', 1) # check numPages if docinfo.get('numPages', 0) == 0: # number of images from digilib if docinfo.get('imagePath', None): - imgpath = docinfo['imagePath'].replace('/mpiwg/online/', '', 1) + imgpath = docinfo['imagePath'].replace('/mpiwg/online', '', 1) logging.debug("imgpath=%s"%imgpath) docinfo['imageURL'] = "%s?fn=%s"%(self.digilibScalerUrl, imgpath) docinfo = self.getDocinfoFromDigilib(docinfo, imgpath) @@ -638,8 +638,11 @@ # replace with numTextPages (text-only?) docinfo['numPages'] = docinfo['numTextPages'] + # normalize path + if 'imagePath' in docinfo and not docinfo['imagePath'].startswith('/'): + docinfo['imagePath'] = '/' + docinfo['imagePath'] + logging.debug("documentViewer (getdocinfo) docinfo: keys=%s"%docinfo.keys()) - #logging.debug("documentViewer (getdocinfo) docinfo: %s"%docinfo) # store in session self.REQUEST.SESSION['docinfo'] = docinfo return docinfo