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:
		
							parent
							
								
									f9ded2be00
								
							
						
					
					
						commit
						584057c173
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		|  | @ -23,6 +23,7 @@ $Id$ | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| import os | import os | ||||||
|  | import shutil | ||||||
| from zope.interface import implements | from zope.interface import implements | ||||||
| import transaction | import transaction | ||||||
| from transaction.interfaces import IDataManager | from transaction.interfaces import IDataManager | ||||||
|  | @ -93,6 +94,15 @@ class FileSystemStorage(object): | ||||||
|         subDir = params.get('subdirectory') |         subDir = params.get('subdirectory') | ||||||
|         return self.getDir(address, subDir) |         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): | class FSSDataManager(object): | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm