provide utility method for copying an external file to an archive location

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3950 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-08-14 19:18:18 +00:00
parent f9ded2be00
commit 584057c173

View file

@ -23,6 +23,7 @@ $Id$
"""
import os
import shutil
from zope.interface import implements
import transaction
from transaction.interfaces import IDataManager
@ -93,6 +94,15 @@ class FileSystemStorage(object):
subDir = params.get('subdirectory')
return self.getDir(address, subDir)
def copyDataFile(self, sourceAddress, sourceParams, targetAddress, targetParams):
source = self.getDir(sourceAddress, sourceParams.get('subdirectory'))
target = self.getDir(targetAddress, targetParams.get('subdirectory'))
targetDir = os.path.dirname(target)
if not os.path.exists(targetDir):
os.makedirs(targetDir)
shutil.copyfile(source, target)
class FSSDataManager(object):