From af6006ffe3d79d4a212bc609fafea471c34374a8 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 29 Jun 2026 18:58:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Python=E4=B8=8A=E4=B8=8B=E6=96=87?= =?UTF-8?q?=E7=9A=84json.dumps=E5=8A=A0json.loads=E5=8C=85=E8=A3=B9,?= =?UTF-8?q?=E9=81=BF=E5=85=8Dtrue=E2=86=92True=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xls2ddl/tmpls.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xls2ddl/tmpls.py b/xls2ddl/tmpls.py index bdceff1..87d73e4 100644 --- a/xls2ddl/tmpls.py +++ b/xls2ddl/tmpls.py @@ -149,7 +149,7 @@ if not ns.get('sort'): {% if type(sortby) == type("") %} ns['sort'] = '{{sortby}}' {% else %} - ns['sort'] = {{json.dumps(sortby)}} + ns['sort'] = json.loads({{json.dumps(sortby)}}) {% endif %} {% else %} ns['sort'] = 'id' @@ -160,7 +160,7 @@ ns['sort'] = '{{relation.outter_field}}_text' sql = '''{{sql}}''' {% if not relation %} {% if data_filter %} -filterjson = {{json.dumps(data_filter, ensure_ascii=False)}} +filterjson = json.loads({{json.dumps(data_filter, ensure_ascii=False)}}) {% else %} filterjson = None fields_str=r'''{{json.dumps(fields, indent=4, ensure_ascii=False)}}''' @@ -450,7 +450,7 @@ async with db.sqlorContext(dbname) as sor: } } {% endif %} - tblfields = {{json.dumps(fields, ensure_ascii=False)}} + tblfields = json.loads({{json.dumps(fields, ensure_ascii=False)}}) tblfname = [ f['name'] for f in tblfields ] other_keys = [ k for k in ns.keys() if k in tblfname and k != 'id' ] if len(other_keys) > 0: