--- ImageArchive/ImageArchive.py 2006/12/13 20:46:51 1.102
+++ ImageArchive/ImageArchive.py 2007/01/31 14:24:17 1.103
@@ -24,9 +24,18 @@ from threading import Thread
import Queue
import cgi
import sys
-import zLOG
+
import shutil
+import logging
+
+#ersetzt logging
+def logger(txt,method,txt2):
+ """logging"""
+ logging.info(txt+ txt2)
+
+
+
from AccessControl import ClassSecurityInfo, getSecurityManager
try:
@@ -518,12 +527,12 @@ class ImageDigilib(Folder,Persistent,Imp
newName=os.path.join(path,self.getId())
if os.path.exists(newName):
- zLOG.LOG("ImageArchive:scaleToJpg", zLOG.INFO, "%s already exists"%newName)
+ logger("ImageArchive:scaleToJpg", logging.INFO, "%s already exists"%newName)
else:
try:
os.rename(imagePath,newName)
except:
- zLOG.LOG("ImageArchive:scaleToJpg", zLOG.ERROR, "%s "%newName)
+ logger("ImageArchive:scaleToJpg", logging.ERROR, "%s "%newName)
return False
ext= os.path.splitext(imagePath)[1].lower()
@@ -564,10 +573,10 @@ class ImageDigilib(Folder,Persistent,Imp
#kopieren der bestehenden Version in den Versions ordner.
imageNewPath=os.path.join(path,"V%i_%s"%(versionNumber,self.filename))
try:
- #zLOG.LOG("ImageArchive:updateImage", zLOG.INFO, "rename: %s -> %s"%(imagePath,imageNewPath))
+ #logger("ImageArchive:updateImage", logging.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))
+ logger("ImageArchive:updateImage", logging.ERROR, "rename: %s -> %s didn't work!"%(imagePath,imageNewPath))
#lesen des upload files und schreiben
filedata=_fileupload.read()
@@ -757,14 +766,14 @@ class ImageCollection(OrderedFolder, Per
fileStr=" -dir=%s"%fileTmp
scaleStr=scaleStr+fileStr
else:
- zLOG.LOG("ImageCollection:scale",zLOG.ERROR,"no directory or filename given")
+ logger("ImageCollection:scale",logging.ERROR,"no directory or filename given")
return False
if dest is not None:
destStr=" -dest=%s"%os.path.join(destBasis,dest)
scaleStr=scaleStr+destStr
else:
- zLOG.LOG("ImageCollection:scale",zLOG.ERROR,"no destionation given")
+ logger("ImageCollection:scale",logging.ERROR,"no destionation given")
return False
if scaleTo:
@@ -774,12 +783,12 @@ class ImageCollection(OrderedFolder, Per
scaleByStr=" -scaleby=%s"%scaleBy
scaleStr=scaleStr+scaleByStr
else:
- zLOG.LOG("ImageCollection:scale",zLOG.ERROR,"no destionation given")
+ logger("ImageCollection:scale",logging.ERROR,"no destionation given")
return False
#ret=scaleStr
- #zLOG.LOG("ImageCollection:scale",zLOG.INFO,scaleStr)
+ #logger("ImageCollection:scale",logging.INFO,scaleStr)
ret=os.popen2(scaleStr,1)[1].read()
if RESPONSE:
@@ -1924,7 +1933,7 @@ class ImageCollectionMD(ImageCollection,
ret=ret+"
"+file+" already exists!"
else:
- zLOG.LOG("ImageArchiveMD:import", zLOG.INFO, "adding ZOPE: %s"%file)
+ logger("ImageArchiveMD:import", logging.INFO, "adding ZOPE: %s"%file)
ret=ret+"
"+file+" created!"
newObj=ImageDigilib(file,file)
#print newObj,file
@@ -1939,8 +1948,8 @@ class ImageCollectionMD(ImageCollection,
args['_table']=self.imageCollectionConfig.getTable()
args[self.imageCollectionConfig.getKey()]=file
- if not self.ZSQLInlineSearch(args=args):
- zLOG.LOG("ImageArchiveMD:import", zLOG.INFO, "adding DB: %s"%file)
+ if not self.ZSQLInline(args=args):
+ logger("ImageArchiveMD:import", logging.INFO, "adding DB: %s"%file)
self.ZSQLAdd(args=args)
#print ret