--- ImageArchive/ImageArchive.py 2006/02/07 18:36:07 1.74 +++ ImageArchive/ImageArchive.py 2006/02/07 20:29:31 1.75 @@ -22,6 +22,7 @@ import time from threading import Thread import Queue import cgi +import zLOG from AccessControl import ClassSecurityInfo, getSecurityManager @@ -481,7 +482,8 @@ class ImageDigilib(Folder,Persistent,Imp def updateImage(self,file,rename=None,RESPONSE=None): """lade neues Version des Bildes""" #teste ob Dokumenten ordner schon vorhanden - imagePath=os.path.join(self.ImageStoragePath,self.getId()) + #imagePath=os.path.join(self.ImageStoragePath,self.getId()) + imagePath=os.path.join(self.ImageStoragePath,self.filename) path=os.path.join(self.ImageStoragePath,"."+self.getId()+".dir") if not os.path.exists(path): @@ -492,16 +494,20 @@ class ImageDigilib(Folder,Persistent,Imp #teste ob version schon existiert - while os.path.exists(os.path.join(path,"V%i_%s"%(versionNumber,self.getId()))): + while os.path.exists(os.path.join(path,"V%i_%s"%(versionNumber,self.filename))): versionNumber+=1 #kopieren der bestehenden Version in den Versions ordner. - imageNewPath=os.path.join(path,"V%i_%s"%(versionNumber,self.getId())) - os.rename(imagePath,imageNewPath) + imageNewPath=os.path.join(path,"V%i_%s"%(versionNumber,self.filename)) + try: + #zLOG.LOG("ImageArchive:updateImage", zLOG.INFO, "rename: %s -> %s"%(imagePath,imageNewPath)) + os.rename(imagePath,imageNewPath) + except: + zLOG.LOG("ImageArchive:updateImage", zLOG.ERROR, "rename: %s -> %s didn't work!"%(imagePath,imageNewPath)) #lesen des upload files und schreiben filedata=file.read() - f=open(imagePath,"w") + f=open(imagePath,"w") # if we wanted to have filename=id we should do it here! f.write(filedata) f.close() try: