From eef7428c2f4d5735573b024ee906cd54423a2974 Mon Sep 17 00:00:00 2001 From: Yaro Kasear Date: Thu, 11 Sep 2025 08:48:28 -0500 Subject: [PATCH] Improved reporting on failed href building. --- crudkit/ui/fragments.py | 6 +++--- inventory/routes/index.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crudkit/ui/fragments.py b/crudkit/ui/fragments.py index e60559d..bfc8b47 100644 --- a/crudkit/ui/fragments.py +++ b/crudkit/ui/fragments.py @@ -82,10 +82,12 @@ def _build_href(spec: Dict[str, Any], row: Dict[str, Any], obj) -> Optional[str] else: params[k] = v if any(v is None for v in params.values()): + print(f"[render_table] url_for failed: endpoint={spec}: params={params}") return None try: return url_for(spec["endpoint"], **params) - except Exception: + except Exception as e: + print(f"[render_table] url_for failed: endpoint={spec['endpoint']} params={params} err={e}") return None def _humanize(field: str) -> str: @@ -144,8 +146,6 @@ def render_table(objects: List[Any], columns: Optional[List[Dict[str, Any]]] = N cells.append({"text": text, "href": href, "class": cls}) disp_rows.append({"id": rd.get("id"), "cells": cells}) - print(disp_rows) - return template.render(columns=cols, rows=disp_rows) def render_form(model_cls, values, session=None): diff --git a/inventory/routes/index.py b/inventory/routes/index.py index b50ea08..8d2a688 100644 --- a/inventory/routes/index.py +++ b/inventory/routes/index.py @@ -30,9 +30,9 @@ def init_index_routes(app): columns = [ {"field": "start_time", "label": "Start", "format": "date"}, {"field": "contact.last_name", "label": "Contact", - "link": {"endpoint": "contact.entry", "params": {"id": "{contact.id}"}}}, + "link": {"endpoint": "user.get_item", "params": {"id": "{contact.id}"}}}, {"field": "work_item.name", "label": "Work Item", - "link": {"endpoint": "work_item.entry", "params": {"id": "{work_item.id}"}}}, + "link": {"endpoint": "inventory.get_item", "params": {"id": "{work_item.id}"}}}, {"field": "complete", "label": "Status", "format": "yesno", "classes": {"true":"badge bg-success","false":"badge bg-warning","none":"text-muted"}}, ]