create directory if it does not exist
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2898 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
d2f070037e
commit
7d83c0dbeb
1 changed files with 4 additions and 1 deletions
|
@ -50,10 +50,13 @@ class FileSystemStorage(object):
|
|||
def setData(self, address, data, params={}):
|
||||
subDir = params.get('subdirectory')
|
||||
fn = self.getDir(address, subDir)
|
||||
directory = os.path.dirname(fn)
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
f = open(fn, 'wb')
|
||||
f.write(data)
|
||||
f.close()
|
||||
print 'cybertools.storage: file %s written' % fn
|
||||
#print 'cybertools.storage: file %s written' % fn
|
||||
# TODO: transaction management:
|
||||
# write to temp file in subDir, keep address in internal dictionary
|
||||
# transaction.manager.get().join(FSSDataManager(address, temp))
|
||||
|
|
Loading…
Add table
Reference in a new issue