Improved reporting on failed href building.
This commit is contained in:
parent
de5e5b4a43
commit
eef7428c2f
2 changed files with 5 additions and 5 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue