[Checkins] SVN: Products.CMFCore/trunk/Products/CMFCore/ - added 'bobobase_modification_time' method to FSObject
Yvo Schubbe
y.2011 at wcm-solutions.de
Tue Feb 8 11:15:09 EST 2011
Log message for revision 120219:
- added 'bobobase_modification_time' method to FSObject
Changed:
U Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
U Products.CMFCore/trunk/Products/CMFCore/FSObject.py
U Products.CMFCore/trunk/Products/CMFCore/tests/test_FSPythonScript.py
-=-
Modified: Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt 2011-02-08 15:54:57 UTC (rev 120218)
+++ Products.CMFCore/trunk/Products/CMFCore/CHANGES.txt 2011-02-08 16:15:09 UTC (rev 120219)
@@ -4,6 +4,9 @@
2.3.0-alpha (unreleased)
------------------------
+- DirectoryView: Added 'bobobase_modification_time' method to FSObject.
+ The "Contents" tab in the ZMI now shows useful 'Last Modified' values.
+
- DirectoryView: Changed debug mode behavior.
No additional subdirs are registered in debug mode. If you add new subdirs,
you have to restart your instance.
Modified: Products.CMFCore/trunk/Products/CMFCore/FSObject.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/FSObject.py 2011-02-08 15:54:57 UTC (rev 120218)
+++ Products.CMFCore/trunk/Products/CMFCore/FSObject.py 2011-02-08 16:15:09 UTC (rev 120219)
@@ -197,6 +197,12 @@
self._updateFromFS()
return DateTime(self._file_mod_time)
+ security.declareProtected(View, 'bobobase_modification_time')
+ def bobobase_modification_time(self):
+ """Get the modification time the file did have last time it was read.
+ """
+ return DateTime(self._file_mod_time)
+
security.declareProtected(ViewManagementScreens, 'getObjectFSPath')
def getObjectFSPath(self):
"""Return the path of the file we represent"""
Modified: Products.CMFCore/trunk/Products/CMFCore/tests/test_FSPythonScript.py
===================================================================
--- Products.CMFCore/trunk/Products/CMFCore/tests/test_FSPythonScript.py 2011-02-08 15:54:57 UTC (rev 120218)
+++ Products.CMFCore/trunk/Products/CMFCore/tests/test_FSPythonScript.py 2011-02-08 16:15:09 UTC (rev 120219)
@@ -17,6 +17,7 @@
from Testing import ZopeTestCase
ZopeTestCase.installProduct('PythonScripts', 1)
+import os
from os.path import join
from sys import exc_info
from thread import start_new_thread
@@ -24,6 +25,7 @@
from AccessControl.SecurityManagement import newSecurityManager
from Acquisition import aq_base
+from DateTime.DateTime import DateTime
from OFS.Folder import Folder
from OFS.SimpleItem import SimpleItem
from Products.StandardCacheManagers import RAMCacheManager
@@ -47,11 +49,24 @@
class FSPythonScriptTests(FSPSMaker):
- def test_get_size( self ):
+ def test_get_size(self):
# Test get_size returns correct value
script = self._makeOne('test1', 'test1.py')
- self.assertEqual(len(script.read()),script.get_size())
+ self.assertEqual(len(script.read()), script.get_size())
+ def test_getModTime(self):
+ script = self._makeOne('test1', 'test1.py')
+ self.assertTrue(isinstance(script.getModTime(), DateTime))
+ self.assertEqual(script.getModTime(),
+ DateTime(os.stat(script._filepath).st_mtime))
+
+ def test_bobobase_modification_time(self):
+ script = self._makeOne('test1', 'test1.py')
+ self.assertTrue(isinstance(script.bobobase_modification_time(),
+ DateTime))
+ self.assertEqual(script.bobobase_modification_time(),
+ DateTime(os.stat(script._filepath).st_mtime))
+
def test_initialization_race_condition(self):
# Tries to exercise a former race condition where
# FSObject._updateFromFS() set self._parsed before the
More information about the checkins
mailing list