Skip to content

Commit

Permalink
Return None instead of floor/ceiling dates
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Aug 14, 2024
1 parent 22db64e commit 2b532a4
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions plone/dexterity/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -591,24 +593,21 @@ 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):
# Dublin Core Date element - date resource becomes effective.
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):
Expand All @@ -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):
Expand Down

0 comments on commit 2b532a4

Please sign in to comment.