From 2160315869224b66ec2947e0d984e3f0799bec1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Warnon?= Date: Wed, 20 Jul 2022 09:02:41 +0000 Subject: [PATCH] [FIX] tools: fix profiler datetime usage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes the profiler datetime usage by properly using the 'real_datetime_now' as a callable. This was breaking the output json file when profiling. closes odoo/odoo#96456 X-original-commit: 5fec27e42b033f79933afb3d0c85b142360981f9 Signed-off-by: Xavier Dollé (xdo) --- odoo/tools/profiler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odoo/tools/profiler.py b/odoo/tools/profiler.py index 63baee7bcc9..28c7dac4d76 100644 --- a/odoo/tools/profiler.py +++ b/odoo/tools/profiler.py @@ -647,7 +647,7 @@ class Profiler: This is mainly useful to uniquify a path between executions. """ return path.format( - time=real_datetime_now.strftime("%Y%m%d-%H%M%S"), + time=real_datetime_now().strftime("%Y%m%d-%H%M%S"), len=self.entry_count(), desc=re.sub("[^0-9a-zA-Z-]+", "_", self.description) ) @@ -667,7 +667,7 @@ class Profiler: return json.dumps({ "name": self.description, "session": self.profile_session, - "create_date": real_datetime_now.strftime("%Y%m%d-%H%M%S"), + "create_date": real_datetime_now().strftime("%Y%m%d-%H%M%S"), "init_stack_trace": _format_stack(self.init_stack_trace), "duration": self.duration, "collectors": {collector.name: collector.entries for collector in self.collectors},