avoid error when no file is present
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3340 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
6a45e33890
commit
7ade90ca9e
1 changed files with 7 additions and 4 deletions
|
@ -83,10 +83,11 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
|
||||||
return self.context.contentType or ''
|
return self.context.contentType or ''
|
||||||
|
|
||||||
def getDataPath(self):
|
def getDataPath(self):
|
||||||
storage = component.getUtility(IExternalStorage, name=self.storageName)
|
storage = component.queryUtility(IExternalStorage, name=self.storageName)
|
||||||
#print '***', self.storageName, self.storageParams, self.options
|
#print '***', self.storageName, self.storageParams, self.options
|
||||||
return storage.getDir(self.externalAddress,
|
if storage is not None:
|
||||||
self.storageParams['subdirectory'])
|
return storage.getDir(self.externalAddress,
|
||||||
|
self.storageParams['subdirectory'])
|
||||||
|
|
||||||
def getOriginalData(self):
|
def getOriginalData(self):
|
||||||
return ExternalFileAdapter.getData(self)
|
return ExternalFileAdapter.getData(self)
|
||||||
|
@ -94,7 +95,9 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
|
||||||
def getModified(self):
|
def getModified(self):
|
||||||
d = getattr(self.context, '_modified', None)
|
d = getattr(self.context, '_modified', None)
|
||||||
if not d:
|
if not d:
|
||||||
return datetime.fromtimestamp(os.path.getmtime(self.getDataPath()))
|
dp = self.getDataPath()
|
||||||
|
if dp is not None:
|
||||||
|
return datetime.fromtimestamp(os.path.getmtime(dp))
|
||||||
return d
|
return d
|
||||||
def setModified(self, value):
|
def setModified(self, value):
|
||||||
self.context._modified = value
|
self.context._modified = value
|
||||||
|
|
Loading…
Add table
Reference in a new issue