From 5107e6c830e0e284088c7cd5c26ace3e77ea4271 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 30 Jun 2026 10:31:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20json.loads=E5=8A=A0=E5=BC=95=E5=8F=B7?= =?UTF-8?q?=E5=8C=85=E8=A3=B9,json.dumps=E8=BE=93=E5=87=BA=E6=98=AFPython?= =?UTF-8?q?=E5=AD=97=E9=9D=A2=E9=87=8F=E4=B8=8D=E6=98=AF=E5=AD=97=E7=AC=A6?= =?UTF-8?q?=E4=B8=B2?= 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 87d73e4..3869bf1 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.loads({{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.loads({{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.loads({{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: