Skip to content

Make _handle param f positional-only to avoid form field collision#895

Open
lisadlima wants to merge 1 commit into
AnswerDotAI:mainfrom
lisadlima:fix-handle-f-collision
Open

Make _handle param f positional-only to avoid form field collision#895
lisadlima wants to merge 1 commit into
AnswerDotAI:mainfrom
lisadlima:fix-handle-f-collision

Conversation

@lisadlima

@lisadlima lisadlima commented Jun 29, 2026

Copy link
Copy Markdown

Closes #834

  • f as a parameter triggers TypeError: _handle() got multiple values for argument 'f', because the form field f arrives via **wreq and collides with _handle's positional f (the handler itself).

  • Makes f positional-only with /: async def _handle(f, /, *args, **kwargs). This is the standard stdlib idiom (functools.partial, functools.reduce) and is preferable to renaming (e.g. _f), which only relocates the collision to a different field name.

  • notebook fasthtml/nbs/api/00_core.py was edited, synced (not core.py directly), cleaned. Test is in nbs/api/00_core.ipynb right under _handle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] "_handle got multiple values for argument f" when a POST route takes f as an argument

1 participant