version 1.74, 2006/02/07 18:36:07
|
version 1.75, 2006/02/07 20:29:31
|
Line 22 import time
|
Line 22 import time
|
from threading import Thread |
from threading import Thread |
import Queue |
import Queue |
import cgi |
import cgi |
|
import zLOG |
|
|
from AccessControl import ClassSecurityInfo, getSecurityManager |
from AccessControl import ClassSecurityInfo, getSecurityManager |
|
|
Line 481 class ImageDigilib(Folder,Persistent,Imp
|
Line 482 class ImageDigilib(Folder,Persistent,Imp
|
def updateImage(self,file,rename=None,RESPONSE=None): |
def updateImage(self,file,rename=None,RESPONSE=None): |
"""lade neues Version des Bildes""" |
"""lade neues Version des Bildes""" |
#teste ob Dokumenten ordner schon vorhanden |
#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") |
path=os.path.join(self.ImageStoragePath,"."+self.getId()+".dir") |
|
|
if not os.path.exists(path): |
if not os.path.exists(path): |
Line 492 class ImageDigilib(Folder,Persistent,Imp
|
Line 494 class ImageDigilib(Folder,Persistent,Imp
|
|
|
#teste ob version schon existiert |
#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 |
versionNumber+=1 |
|
|
#kopieren der bestehenden Version in den Versions ordner. |
#kopieren der bestehenden Version in den Versions ordner. |
imageNewPath=os.path.join(path,"V%i_%s"%(versionNumber,self.getId())) |
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) |
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 |
#lesen des upload files und schreiben |
filedata=file.read() |
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.write(filedata) |
f.close() |
f.close() |
try: |
try: |