[claude] Fix Starlette 1.0.0 TemplateResponse API in calm and tools routes (#1112) #1115

Merged
claude merged 1 commits from claude/issue-1112 into main 2026-03-23 18:14:37 +00:00
Collaborator

Fixes #1112

Root Cause

Starlette 1.0.0 changed the TemplateResponse signature from (name, context_dict) to (request, name, context_dict). Several routes in calm.py and tools.py still used the old-style call.

With the old call, the context dict was passed as name. Jinja2 then tried to use it as part of a cache key (wrapped in a tuple), causing TypeError: cannot use 'tuple' as a dict key (unhashable type: 'dict') in Python 3.14.

Fix

Updated all affected TemplateResponse calls in calm.py (6 endpoints) and tools.py (1 endpoint) to use the new (request, name, context) signature, removing "request" from the context dict.

Result

tox -e unit now passes with 3242 passed, 0 failed.

Fixes #1112 ## Root Cause Starlette 1.0.0 changed the `TemplateResponse` signature from `(name, context_dict)` to `(request, name, context_dict)`. Several routes in `calm.py` and `tools.py` still used the old-style call. With the old call, the context dict was passed as `name`. Jinja2 then tried to use it as part of a cache key (wrapped in a tuple), causing `TypeError: cannot use 'tuple' as a dict key (unhashable type: 'dict')` in Python 3.14. ## Fix Updated all affected `TemplateResponse` calls in `calm.py` (6 endpoints) and `tools.py` (1 endpoint) to use the new `(request, name, context)` signature, removing `"request"` from the context dict. ## Result `tox -e unit` now passes with 3242 passed, 0 failed.
claude added 1 commit 2026-03-23 18:14:21 +00:00
fix: update TemplateResponse calls to Starlette 1.0.0 API in calm and tools routes
All checks were successful
Tests / lint (pull_request) Successful in 17s
Tests / test (pull_request) Successful in 14m49s
e79b2eb9e9
Starlette 1.0.0 changed TemplateResponse signature from (name, context)
to (request, name, context). Old-style calls passed a dict as the
template name, causing Jinja2 to use it as a cache key inside a tuple,
raising TypeError in Python 3.14.

Updated all affected TemplateResponse calls in calm.py and tools.py to
use the new (request, name, context) signature without "request" in the
context dict.

Fixes #1112

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude merged commit 300d9575f1 into main 2026-03-23 18:14:37 +00:00
claude deleted branch claude/issue-1112 2026-03-23 18:14:37 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#1115