Skip to content

Commit

Permalink
[fc] Repository: plone.namedfile
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2023-10-17T20:30:21-07:00
Author: David Glick (davisagli) <[email protected]>
Commit: plone/plone.namedfile@8e91816

Fix the modified property

Files changed:
M plone/namedfile/file.py
M plone/namedfile/tests/test_blobfile.py
Repository: plone.namedfile

Branch: refs/heads/master
Date: 2023-10-17T20:36:04-07:00
Author: David Glick (davisagli) <[email protected]>
Commit: plone/plone.namedfile@1a75884

changelog

Files changed:
A news/153.bugfix
Repository: plone.namedfile

Branch: refs/heads/master
Date: 2023-10-18T11:39:10+02:00
Author: Gil Forcada Codinachs (gforcada) <[email protected]>
Commit: plone/plone.namedfile@1cd966a

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
  • Loading branch information
gforcada committed Oct 18, 2023
1 parent f50d878 commit 80c2522
Showing 1 changed file with 43 additions and 11 deletions.
54 changes: 43 additions & 11 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
Repository: plone.restapi
Repository: plone.namedfile


Branch: refs/heads/main
Date: 2023-10-18T11:28:38+02:00
Author: Timo Stollenwerk (tisto) <stollenwerk@kitconcept.com>
Commit: https://github.com/plone/plone.restapi/commit/13a8b218347b53acf5082cb38680ce9d989f2fdc
Branch: refs/heads/master
Date: 2023-10-17T20:30:21-07:00
Author: David Glick (davisagli) <david@glicksoftware.com>
Commit: https://github.com/plone/plone.namedfile/commit/8e918168ae60f8fdbab64f697776e914e3bb5d44

Make changelog entries consistent
Fix the modified property

Files changed:
M news/1.bugfix
M news/1720.internal
M news/1722.feature
M news/1723.bugfix
M plone/namedfile/file.py
M plone/namedfile/tests/test_blobfile.py

b'diff --git a/news/1.bugfix b/news/1.bugfix\nindex 1494e057f..d993a820e 100644\n--- a/news/1.bugfix\n+++ b/news/1.bugfix\n@@ -1,2 +1 @@\n-Replace deprecated assert methods.\n-[gforcada]\n+Replace deprecated assert methods. @gforcada\ndiff --git a/news/1720.internal b/news/1720.internal\nindex 1ce1f5bf9..039eb7572 100644\n--- a/news/1720.internal\n+++ b/news/1720.internal\n@@ -1,2 +1 @@\n-Drop, already unused plone.app.robotframework test.\n-[gforcada]\n+Drop, already unused plone.app.robotframework test. @gforcada\ndiff --git a/news/1722.feature b/news/1722.feature\nindex f450b5576..a9860dba0 100644\n--- a/news/1722.feature\n+++ b/news/1722.feature\n@@ -1 +1 @@\n-Add support for Python 3.12 @tisto\n\\ No newline at end of file\n+Add support for Python 3.12. @tisto\n\\ No newline at end of file\ndiff --git a/news/1723.bugfix b/news/1723.bugfix\nindex dc682e57c..b1ada0b22 100644\n--- a/news/1723.bugfix\n+++ b/news/1723.bugfix\n@@ -1 +1 @@\n-limits the use of multilingual services only if multilingual is actually installed. @mamico\n+Limits the use of multilingual services only if multilingual is actually installed. @mamico\n'
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) <[email protected]>
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) <[email protected]>
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'

0 comments on commit 80c2522

Please sign in to comment.