# HG changeset patch # User Goffi # Date 1594883246 -7200 # Node ID 29f8122f00f378029b4e260fb8ee7ac3df562145 # Parent e4121a1f2399af89a638c6de8aafdf56140ad959 tools (common/template): use `to_json` instead of `json` + added missing args to `date_fmt` diff -r e4121a1f2399 -r 29f8122f00f3 sat/tools/common/template.py --- a/sat/tools/common/template.py Thu Jul 16 09:07:26 2020 +0200 +++ b/sat/tools/common/template.py Thu Jul 16 09:07:26 2020 +0200 @@ -454,7 +454,7 @@ 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 @@ 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: