-
Notifications
You must be signed in to change notification settings - Fork 285
Description
Important Notice
We do not provide support through GitHub issues. For community-based help, please use either:
- GitHub Discussions tab
- Our Discord channel
If you're reporting a bug, please continue with this template.
Describe the bug
The problem is with your Optional[float] type annotation for the price parameter . When FastHTML encounters an empty string from your form submission, it attempts to convert it to a float, which fails and triggers the 404 error core.py:204-205 .
Here's what's happening in the _fix_anno function when processing your Optional[float] parameter core.py:83-92 :
FastHTML extracts the first non-None type from the union (Optional[float] becomes float) core.py:86-87
It tries to convert the empty string "" to float(""), which raises a ValueError
This ValueError is caught and converted to a 404 error core.py:204-205
Minimal Reproducible Example
Provide a minimal code snippet that reproduces the issue. This is crucial for us to understand and fix the bug quickly.
# Your code here
Expected behavior
A clear and concise description of what you expected to happen.
Environment Information
Please provide the following version information:
- fastlite version:
- fastcore version:
- fasthtml version:
Confirmation
Please confirm the following:
- I have read the FAQ (https://docs.fastht.ml/explains/faq.html)
- I have provided a minimal reproducible example
- I have included the versions of fastlite, fastcore, and fasthtml
- I understand that this is a volunteer open source project with no commercial support.
Additional context
Add any other context about the problem here.
Screenshots
If applicable, add screenshots to help explain your problem.