avoid error when file is not accessible, log error message instead
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3190 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
b773f21b54
commit
91a4203749
1 changed files with 10 additions and 4 deletions
|
@ -65,10 +65,16 @@ class FileSystemStorage(object):
|
|||
def getData(self, address, params={}):
|
||||
subDir = params.get('subdirectory')
|
||||
fn = self.getDir(address, subDir)
|
||||
f = open(fn, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
return data
|
||||
try:
|
||||
f = open(fn, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
return data
|
||||
except IOError, e:
|
||||
from logging import getLogger
|
||||
getLogger('cybertools.storage.filesystem.FileSystemStorage').warn(e)
|
||||
#'File %r cannot be read.' % fn)
|
||||
return ''
|
||||
|
||||
def getUniqueAddress(self, address, params={}):
|
||||
subDir = params.get('subdirectory')
|
||||
|
|
Loading…
Add table
Reference in a new issue