take modification date for media assets from file, not from the resource object

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3229 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-02-15 10:22:01 +00:00
parent c649dc8fd7
commit 095d6589c0
2 changed files with 11 additions and 4 deletions

View file

@ -200,8 +200,10 @@ class BaseView(GenericView, I18NView):
def modified(self):
""" get date/time of last modification
"""
dc = IZopeDublinCore(self.context)
d = dc.modified or dc.created
d = getattr(self.adapted, 'modified', None)
if not d:
dc = IZopeDublinCore(self.context)
d = dc.modified or dc.created
return d and d.strftime('%Y-%m-%d %H:%M') or ''
@Lazy

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ Original authors: Johann Schimpf, Erich Seifert.
$Id$
"""
from datetime import datetime
from logging import getLogger
import os
@ -83,8 +84,12 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
storage = component.getUtility(IExternalStorage, name=self.storageName)
#print '***', self.storageName, self.storageParams, self.options
return storage.getDir(self.externalAddress,
#self.options['storage_parameters'])
self.storageParams['subdirectory'])
def getOriginalData(self):
return ExternalFileAdapter.getData(self)
@property
def modified(self):
return datetime.fromtimestamp(os.path.getctime(self.getDataPath()))