--- ImageArchive/ImageArchive.py 2006/05/24 09:56:58 1.93 +++ ImageArchive/ImageArchive.py 2006/05/25 15:49:42 1.94 @@ -49,8 +49,8 @@ except: manage_options=() - -tdir = "/mpiwg/temp/tmp/archivesImageServer/" +tdir="tmp" +#tdir = "/mpiwg/temp/tmp/archivesImageServer/" #tdir="/tmp/archivesImageServer/" imageExtensions=['jpg','jpeg','tif','tiff','png'] @@ -80,16 +80,19 @@ class generateSet: """generateSetThread""" - def __init__(self,filenames,filenamesIds,ImageViewerPath,ids,url,local=None,version="working"): + def __init__(self,filenames,filenamesIds,ImageViewerPath,ImageStoragePath,destBasis,ids,url,local=None,version="working"): """init generateSet""" self.filenames=filenames self.filenamesIds=filenamesIds self.ImageViewerPath=ImageViewerPath + self.ImageStoragePath=ImageStoragePath + self.destBasis=destBasis self.ids=ids self.local=local self.url=url self.version=version self.done=None + self.response="" def __call__(self): @@ -115,26 +118,34 @@ class generateSet: for id in self.filenames: - if self.filenamesIds.has_key(id[0]): + if self.filenamesIds.has_key(id[0]) and self.filenamesIds[id[0]][0]: filename=self.filenamesIds[id[0]][0]+"_"+id[0] else: filename=id[0] self.response+=str("

Get File: %s
\n"%filename) - + toggle=False + if self.local: if self.version=="working": - - sourcePath="/mpiwg/temp/online/scaled/small/"+self.ImageViewerPath+"/"+os.path.splitext(id[0])[0]+".jpg" - else: - sourcePath="/mpiwg/online/"+self.ImageViewerPath+"/"+id[0] + + sourcePath=self.destBasis+"/"+self.ImageViewerPath+"/"+os.path.splitext(id[0])[0]+".jpg" + if not os.path.exists(sourcePath): + self.response+=str("

%s doesn't exist I'll try the non scaled image

"%sourcePath) + toggle=True + if (self.version!="working") or toggle: + toggle=False + sourcePath=self.ImageStoragePath+"/"+id[0] + if not os.path.exists(sourcePath): + sourcePath=self.ImageStoragePath+"/"+os.path.splitext(id[0])[0]+".jpg" + targetPath=tmpPath+"/"+filename try: shutil.copyfile(sourcePath,targetPath) except: - self.response+=(str("

Error in File: %s (possible missing)
\n"%filename)) + self.response+=(str("

Error in File: %s (possible missing)
\n"%sourcePath)) else: if self.version=="working": requestString=self.ImageViewerPath+"/"+os.path.splitext(urllib.quote(id[0]))[0]+"&dh=2000&dw=2000" @@ -828,7 +839,7 @@ class ImageCollection(OrderedFolder, Per if not threadName or threadName=="": - threadStart=generateSet(self.REQUEST.SESSION['filenames'],self.REQUEST.SESSION['filenamesIds'],self.ImageViewerPath,self.show_thumbs(),self.absolute_url(),local=local,version=version) + threadStart=generateSet(self.REQUEST.SESSION['filenames'],self.REQUEST.SESSION['filenamesIds'],self.ImageViewerPath,self.ImageStoragePath,self.destBasis,self.show_thumbs(),self.absolute_url(),local=local,version=version) thread=Thread(target=threadStart) thread.start()