From 9f6365f0bd458e44858ad3acfd691d2725ebfaef Mon Sep 17 00:00:00 2001 From: drfho Date: Thu, 7 Mar 2024 15:00:25 +0800 Subject: [PATCH] fix: activity date type (ZBS) --- Products/zms/_objattrs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Products/zms/_objattrs.py b/Products/zms/_objattrs.py index 07a54e5b..de98675c 100644 --- a/Products/zms/_objattrs.py +++ b/Products/zms/_objattrs.py @@ -691,6 +691,9 @@ def isActive(self, REQUEST): # Start time. elif key == 'attr_active_start': if value is not None: + if isinstance(value, time.struct_time): + # Convert time.struct_time to datetime tuple. + value = tuple(value[:8]) + (0,) dt = datetime.datetime.fromtimestamp(time.mktime(value)) b = b and now > dt if dt > now and self.REQUEST.get('ZMS_CACHE_EXPIRE_DATETIME', dt) >= dt: @@ -698,6 +701,9 @@ def isActive(self, REQUEST): # End time. elif key == 'attr_active_end': if value is not None: + if isinstance(value, time.struct_time): + # Convert time.struct_time to datetime tuple. + value = tuple(value[:8]) + (0,) dt = datetime.datetime.fromtimestamp(time.mktime(value)) b = b and dt > now if dt > now and self.REQUEST.get('ZMS_CACHE_EXPIRE_DATETIME', dt) >= dt: