From 820fa05d498f5a9c0e1671fa174cc19d13550a4e Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 16 Jul 2020 09:07:26 +0200 Subject: [PATCH] tools (common/template): use `to_json` instead of `json` + added missing args to `date_fmt` --- sat/tools/common/template.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sat/tools/common/template.py b/sat/tools/common/template.py index 6790a350..cc797552 100644 --- a/sat/tools/common/template.py +++ b/sat/tools/common/template.py @@ -454,7 +454,7 @@ class Renderer(object): self.env.policies["json.dumps_kwargs"] = { "sort_keys": True, # if object can't be serialised, we use None - "default": lambda o: o.json() if hasattr(o, "json") else None + "default": lambda o: o.to_json() if hasattr(o, "to_json") else None } def getFrontURL(self, template_data, path=None): @@ -734,8 +734,8 @@ class Renderer(object): current = ctx["gidx"].current(value) return value if not current else "{}_{}".format(value, current) - def _date_fmt(self, timestamp, fmt="short", date_only=False, auto_limit=None, - auto_old_fmt=None): + def _date_fmt(self, timestamp, fmt="short", date_only=False, auto_limit=7, + auto_old_fmt="short", auto_new_fmt="relative"): if is_undefined(fmt): fmt = "short" try: