diff --git a/last_commit.txt b/last_commit.txt index b88eb75d00..14938030ab 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,50 +1,16 @@ -Repository: plone.namedfile +Repository: plone.restapi -Branch: refs/heads/master -Date: 2023-10-17T20:30:21-07:00 -Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.namedfile/commit/8e918168ae60f8fdbab64f697776e914e3bb5d44 +Branch: refs/heads/main +Date: 2023-10-18T11:48:36+02:00 +Author: Timo Stollenwerk (tisto) +Commit: https://github.com/plone/plone.restapi/commit/d68bb76246b07aa49fa9dc8a529f55affc58ecf9 -Fix the modified property +Fix changelog for #1719 Files changed: -M plone/namedfile/file.py -M plone/namedfile/tests/test_blobfile.py +A news/1719.internal +D news/1.bugfix -b'diff --git a/plone/namedfile/file.py b/plone/namedfile/file.py\nindex 36dd30b..ae50723 100644\n--- a/plone/namedfile/file.py\n+++ b/plone/namedfile/file.py\n@@ -75,7 +75,7 @@ class ModifiedPropertyMixin:\n @property\n def modified(self):\n if hasattr(self, "_modified"):\n- return self._modified\n+ return self._modified / 1000\n # Fall back to modification time in database.\n return self._p_mtime\n \ndiff --git a/plone/namedfile/tests/test_blobfile.py b/plone/namedfile/tests/test_blobfile.py\nindex 67f7107..30d32b3 100644\n--- a/plone/namedfile/tests/test_blobfile.py\n+++ b/plone/namedfile/tests/test_blobfile.py\n@@ -81,19 +81,19 @@ def testModifiedTimeStamp(self):\n image = self._makeImage()\n old_timestamp = image.modified\n time.sleep(1/1000) # make sure at least 1ms passes\n+ now = DateTime()\n+ self.assertGreater(now, DateTime(old_timestamp))\n image._setData(zptlogo)\n self.assertNotEqual(image.modified, old_timestamp)\n \n def testFallBackToDatabaseModifiedTimeStamp(self):\n dt = DateTime()\n image = MockNamedBlobImage()\n- image._p_mtime = dt.millis()\n+ image._p_mtime = int(dt)\n image._modified = (dt + 1).millis()\n \n delattr(image, "_modified")\n- marker = object()\n- self.assertEqual(marker, getattr(image, "_modified", marker))\n- self.assertEqual(dt.millis(), image._p_mtime)\n+ self.assertEqual(image.modified, image._p_mtime)\n \n def testInterface(self):\n self.assertTrue(INamedBlobImage.implementedBy(NamedBlobImage))\n' - -Repository: plone.namedfile - - -Branch: refs/heads/master -Date: 2023-10-17T20:36:04-07:00 -Author: David Glick (davisagli) -Commit: https://github.com/plone/plone.namedfile/commit/1a7588449bf21a6cb6d7a87933a370cf4052bd2c - -changelog - -Files changed: -A news/153.bugfix - -b'diff --git a/news/153.bugfix b/news/153.bugfix\nnew file mode 100644\nindex 0000000..f3d26eb\n--- /dev/null\n+++ b/news/153.bugfix\n@@ -0,0 +1 @@\n+Fix calculation of file modification time. @davisagli\n' - -Repository: plone.namedfile - - -Branch: refs/heads/master -Date: 2023-10-18T11:39:10+02:00 -Author: Gil Forcada Codinachs (gforcada) -Commit: https://github.com/plone/plone.namedfile/commit/1cd966a0b5683ee06bb33987e193d05881eb8a79 - -Merge pull request #153 from plone/fix-modified - -Fix the NamedFile modified property - -Files changed: -A news/153.bugfix -M plone/namedfile/file.py -M plone/namedfile/tests/test_blobfile.py - -b'diff --git a/news/153.bugfix b/news/153.bugfix\nnew file mode 100644\nindex 0000000..f3d26eb\n--- /dev/null\n+++ b/news/153.bugfix\n@@ -0,0 +1 @@\n+Fix calculation of file modification time. @davisagli\ndiff --git a/plone/namedfile/file.py b/plone/namedfile/file.py\nindex 36dd30b..ae50723 100644\n--- a/plone/namedfile/file.py\n+++ b/plone/namedfile/file.py\n@@ -75,7 +75,7 @@ class ModifiedPropertyMixin:\n @property\n def modified(self):\n if hasattr(self, "_modified"):\n- return self._modified\n+ return self._modified / 1000\n # Fall back to modification time in database.\n return self._p_mtime\n \ndiff --git a/plone/namedfile/tests/test_blobfile.py b/plone/namedfile/tests/test_blobfile.py\nindex 67f7107..30d32b3 100644\n--- a/plone/namedfile/tests/test_blobfile.py\n+++ b/plone/namedfile/tests/test_blobfile.py\n@@ -81,19 +81,19 @@ def testModifiedTimeStamp(self):\n image = self._makeImage()\n old_timestamp = image.modified\n time.sleep(1/1000) # make sure at least 1ms passes\n+ now = DateTime()\n+ self.assertGreater(now, DateTime(old_timestamp))\n image._setData(zptlogo)\n self.assertNotEqual(image.modified, old_timestamp)\n \n def testFallBackToDatabaseModifiedTimeStamp(self):\n dt = DateTime()\n image = MockNamedBlobImage()\n- image._p_mtime = dt.millis()\n+ image._p_mtime = int(dt)\n image._modified = (dt + 1).millis()\n \n delattr(image, "_modified")\n- marker = object()\n- self.assertEqual(marker, getattr(image, "_modified", marker))\n- self.assertEqual(dt.millis(), image._p_mtime)\n+ self.assertEqual(image.modified, image._p_mtime)\n \n def testInterface(self):\n self.assertTrue(INamedBlobImage.implementedBy(NamedBlobImage))\n' +b'diff --git a/news/1.bugfix b/news/1719.internal\nsimilarity index 100%\nrename from news/1.bugfix\nrename to news/1719.internal\n'