# HG changeset patch # User casties # Date 1353341713 -3600 # Node ID 3b79ae4a23ca69929caddf09a161ae584f26695d # Parent 4fe11d2bd4ae052ccdc03b8dec2d0fefecde9982 normalize uri of annotated image. diff -r 4fe11d2bd4ae -r 3b79ae4a23ca documentViewer.py --- 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 diff -r 4fe11d2bd4ae -r 3b79ae4a23ca zpt/viewer/layer_image_annotator.zpt --- a/zpt/viewer/layer_image_annotator.zpt Mon Nov 19 16:35:56 2012 +0100 +++ b/zpt/viewer/layer_image_annotator.zpt Mon Nov 19 17:15:13 2012 +0100 @@ -12,7 +12,7 @@