commit fc91486 在新增模板中加了回查 SELECT:
SELECT * FROM tbl WHERE {{summary[0].pkey}} = ${id}$
但 model 的 summary 里主键字段叫 primary 不是 pkey,
Jinja2 取不到返回 None,渲染成 ${None}$,
sqlor 处理后变成 WHERE None = %s。
改为 {{summary[0].primary[0]}},取 primary 数组第一个元素。
31 lines
671 B
Python
31 lines
671 B
Python
import sys
|
|
|
|
|
|
def _pythonlib_compat():
|
|
"""
|
|
On Python 3.7 and earlier, distutils would include the Python
|
|
library. See pypa/distutils#9.
|
|
"""
|
|
from distutils import sysconfig
|
|
if not sysconfig.get_config_var('Py_ENABLED_SHARED'):
|
|
return
|
|
|
|
yield 'python{}.{}{}'.format(
|
|
sys.hexversion >> 24,
|
|
(sys.hexversion >> 16) & 0xff,
|
|
sysconfig.get_config_var('ABIFLAGS'),
|
|
)
|
|
|
|
|
|
def compose(f1, f2):
|
|
return lambda *args, **kwargs: f1(f2(*args, **kwargs))
|
|
|
|
|
|
pythonlib = (
|
|
compose(list, _pythonlib_compat)
|
|
if sys.version_info < (3, 8)
|
|
and sys.platform != 'darwin'
|
|
and sys.platform[:3] != 'aix'
|
|
else list
|
|
)
|