From 97c7d2f368c83e6aa10d5622eda503923357bb38 Mon Sep 17 00:00:00 2001 From: ymq Date: Mon, 31 Aug 2026 16:37:18 +0800 Subject: [PATCH] =?UTF-8?q?fix(retro):=20=5Frows=5Fto=5Fdicts=E7=94=A8dict?= =?UTF-8?q?(rec)=E2=80=94=E2=80=94sqlor=E8=A1=8C=E6=98=AFDictObject,vars()?= =?UTF-8?q?=E5=8F=AA=E5=8F=96=E5=86=85=E9=83=A8=E5=B1=9E=E6=80=A7=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E5=A4=8D=E7=9B=98=E7=B4=A0=E6=9D=90=E5=85=A8=E7=A9=BA?= =?UTF-8?q?=E5=A3=B3(=E6=B5=8B=E8=AF=95=E6=9C=BA=E5=86=92=E7=83=9F?= =?UTF-8?q?=E5=AE=9E=E6=B5=8B)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pipeline_service/retrospective_capability.py | 21 +++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/pipeline_service/retrospective_capability.py b/pipeline_service/retrospective_capability.py index ccc056b..8c4e37f 100644 --- a/pipeline_service/retrospective_capability.py +++ b/pipeline_service/retrospective_capability.py @@ -30,12 +30,23 @@ def _get_db(): def _rows_to_dicts(recs, limit=200): out = [] for r in (recs or [])[:limit]: - d = {} - for k, v in vars(r).items(): - if k.startswith('_') or callable(v): + # sqlor 行是 DictObject:dict(rec) 才能取全部列(vars() 只取内部属性 → 空字典, + # 2026-08-31 测试机冒烟实测:project 名空壳即此因)。照抄 feature_capability._rec_to_dict。 + if isinstance(r, dict): + out.append(dict(r)) + continue + try: + out.append(dict(r)) + continue + except (TypeError, ValueError): + pass + if hasattr(r, "to_dict"): + try: + out.append(r.to_dict()) continue - d[k] = v - out.append(d) + except Exception: + pass + out.append({}) return out