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

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 # 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 # it under the terms of the GNU General Public License as published by
@ -24,6 +24,7 @@ Original authors: Johann Schimpf, Erich Seifert.
$Id$ $Id$
""" """
from datetime import datetime
from logging import getLogger from logging import getLogger
import os import os
@ -83,8 +84,12 @@ class MediaAsset(MediaAssetFile, ExternalFileAdapter):
storage = component.getUtility(IExternalStorage, name=self.storageName) storage = component.getUtility(IExternalStorage, name=self.storageName)
#print '***', self.storageName, self.storageParams, self.options #print '***', self.storageName, self.storageParams, self.options
return storage.getDir(self.externalAddress, return storage.getDir(self.externalAddress,
#self.options['storage_parameters'])
self.storageParams['subdirectory']) self.storageParams['subdirectory'])
def getOriginalData(self): def getOriginalData(self):
return ExternalFileAdapter.getData(self) return ExternalFileAdapter.getData(self)
@property
def modified(self):
return datetime.fromtimestamp(os.path.getctime(self.getDataPath()))