[Checkins] SVN: zope.app.file/branches/3.4/ - Using IDCTimes
interface instead of IZopeDublinCore to determine the
Christian Zagrodnick
cz at gocept.com
Wed Jun 18 10:46:33 EDT 2008
Log message for revision 87521:
- Using IDCTimes interface instead of IZopeDublinCore to determine the
modification date of a file. [backported from trunk]
Changed:
U zope.app.file/branches/3.4/CHANGES.txt
U zope.app.file/branches/3.4/src/zope/app/file/browser/file.py
-=-
Modified: zope.app.file/branches/3.4/CHANGES.txt
===================================================================
--- zope.app.file/branches/3.4/CHANGES.txt 2008-06-18 13:55:58 UTC (rev 87520)
+++ zope.app.file/branches/3.4/CHANGES.txt 2008-06-18 14:46:32 UTC (rev 87521)
@@ -5,7 +5,8 @@
3.4.3 (unreleased)
------------------
-- ...
+- Using IDCTimes interface instead of IZopeDublinCore to determine the
+ modification date of a file.
3.4.2 (2007-11-09)
------------------
Modified: zope.app.file/branches/3.4/src/zope/app/file/browser/file.py
===================================================================
--- zope.app.file/branches/3.4/src/zope/app/file/browser/file.py 2008-06-18 13:55:58 UTC (rev 87520)
+++ zope.app.file/branches/3.4/src/zope/app/file/browser/file.py 2008-06-18 14:46:32 UTC (rev 87521)
@@ -25,7 +25,7 @@
from zope.app.file.file import File
from zope.app.file.interfaces import IFile
from zope.app.file.i18n import ZopeMessageFactory as _
-from zope.dublincore.interfaces import IZopeDublinCore
+from zope.dublincore.interfaces import IDCTimes
import zope.datetime
import time
@@ -39,8 +39,8 @@
"""Sets various headers if the request is present and returns the
data of the file. If the "If-Modified-Since" header is set and
- the context implements IZopeDublinCore, data is only returned if
- the modification date of the context is new than the date in the
+ the context is adaptable to IDCTimes, data is only returned if
+ the modification date of the context is newer than the date in the
"If-Modified-Since" header
>>> from zope.publisher.browser import BrowserView, TestRequest
>>> class FileTestView(FileView, BrowserView): pass
@@ -62,14 +62,15 @@
>>> request.response.getHeader('Content-Length')
'12'
- If the file is adaptable to IZopeDublinCore the
- "Last-Modified" header is also set.
+ If the file is adaptable to IDCTimes the "Last-Modified" header is also
+ set.
>>> request.response.getHeader('Last-Modified') is None
True
For the test we just declare that our file provides
IZopeDublinCore
+ >>> from zope.dublincore.interfaces import IZopeDublinCore
>>> from zope.interface import directlyProvides
>>> directlyProvides(aFile,IZopeDublinCore)
>>> request = TestRequest()
@@ -100,7 +101,7 @@
self.request.response.setHeader('Content-Length',
self.context.getSize())
try:
- modified = IZopeDublinCore(self.context).modified
+ modified = IDCTimes(self.context).modified
except TypeError:
modified=None
if modified is None or not isinstance(modified,datetime):
More information about the Checkins
mailing list