Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for async validation mechanisms #839

Open
simonw opened this issue Mar 19, 2024 · 0 comments
Open

Support for async validation mechanisms #839

simonw opened this issue Mar 19, 2024 · 0 comments
Labels
enhancement New feature, or existing feature improvement

Comments

@simonw
Copy link

simonw commented Mar 19, 2024

I found myself wanting to add a custom validator to a form that makes an asynchronous HTTP request (using httpx) to confirm that a provided URL was valid - but realized that wtforms currently only supports blocking synchronous functions for validators.

There is a project that extends wtforms to work with async, but it's packaged for Starlette which I'm not using here: https://github.com/kubetail-org/starlette-wtf/blob/master/starlette_wtf/form.py

It would be great if wtforms provided an async validation mechanism in the default package. It's an increasingly common pattern thanks to the popularity of projects like Starlette and FastAPI. My own Datasette package uses async and has recently adopted wtforms for the enrichments feature, which is how I found this limitation.

@azmeuk azmeuk added the enhancement New feature, or existing feature improvement label Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, or existing feature improvement
Development

No branches or pull requests

2 participants