From 2b532a4ec4f6362aee085b8293144d34484ad0bf Mon Sep 17 00:00:00 2001 From: David Glick Date: Wed, 14 Aug 2024 10:28:09 -0700 Subject: [PATCH] Return None instead of floor/ceiling dates --- plone/dexterity/content.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/plone/dexterity/content.py b/plone/dexterity/content.py index 7224d3e..e4dac87 100644 --- a/plone/dexterity/content.py +++ b/plone/dexterity/content.py @@ -55,6 +55,8 @@ _marker = object() _zone = DateTime().timezone() _recursion_detection = threading.local() + +# for backwards-compatibility FLOOR_DATE = DateTime(1970, 0) # always effective CEILING_DATE = DateTime(2500, 0) # never expires @@ -591,8 +593,7 @@ def created(self): # Dublin Core Date element - date resource created. # allow for non-existent creation_date, existed always date = getattr(self, "creation_date", None) - date = datify(date) - return date is None and FLOOR_DATE or date + return datify(date) @security.protected(permissions.View) def effective(self): @@ -600,15 +601,13 @@ def effective(self): date = getattr(self, "effective_date", _marker) if date is _marker: date = getattr(self, "creation_date", None) - date = datify(date) - return date is None and FLOOR_DATE or date + return datify(date) @security.protected(permissions.View) def expires(self): # Dublin Core Date element - date resource expires. date = getattr(self, "expiration_date", None) - date = datify(date) - return date is None and CEILING_DATE or date + return datify(date) @security.protected(permissions.View) def modified(self): @@ -618,8 +617,7 @@ def modified(self): # Upgrade. date = DateTime(self._p_mtime) self.modification_date = date - date = datify(date) - return date + return datify(date) @security.protected(permissions.View) def isEffective(self, date):