优化事件触发Condition判断逻辑
This commit is contained in:
parent
5de12da59c
commit
368ac78d63
@ -4,7 +4,6 @@
|
|||||||
import jingrow
|
import jingrow
|
||||||
import logging
|
import logging
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
from collections import defaultdict
|
|
||||||
from jingrow.utils.jingrow_api import get_record_list, get_pagetype_module_app, get_record
|
from jingrow.utils.jingrow_api import get_record_list, get_pagetype_module_app, get_record
|
||||||
|
|
||||||
|
|
||||||
@ -113,17 +112,7 @@ def run_agent(pg=None, method=None, event=None, page=None, **kwargs):
|
|||||||
api_res = get_record(str(_pt), str(_nm))
|
api_res = get_record(str(_pt), str(_nm))
|
||||||
if api_res and api_res.get("success") and isinstance(api_res.get("data"), dict):
|
if api_res and api_res.get("success") and isinstance(api_res.get("data"), dict):
|
||||||
pg_ctx = api_res.get("data")
|
pg_ctx = api_res.get("data")
|
||||||
# 将 None 统一视为空字符串;并为缺失键提供空字符串默认值
|
result = jtpl.render(pg=pg_ctx)
|
||||||
pg_coerced = {}
|
|
||||||
for _k, _v in (pg_ctx or {}).items():
|
|
||||||
if _v is None:
|
|
||||||
pg_coerced[_k] = ""
|
|
||||||
elif isinstance(_v, str):
|
|
||||||
pg_coerced[_k] = _v
|
|
||||||
else:
|
|
||||||
pg_coerced[_k] = _v
|
|
||||||
pg_safe = defaultdict(lambda: "", pg_coerced)
|
|
||||||
result = jtpl.render(pg=pg_safe)
|
|
||||||
if str(result).strip().lower() in ("true", "1", "yes"):
|
if str(result).strip().lower() in ("true", "1", "yes"):
|
||||||
trigger = True
|
trigger = True
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user