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

Convert request params based on function annotations. #1441

Closed
coady opened this issue Jun 5, 2016 · 0 comments
Closed

Convert request params based on function annotations. #1441

coady opened this issue Jun 5, 2016 · 0 comments

Comments

@coady
Copy link
Contributor

coady commented Jun 5, 2016

With the increasing focus on type hints in Python, having a tool which automatically converted query params (with exception handling) would be a nice feature.

It's common for apps to have boilerplate code for converting request params, and returning 400-levels errors on failure.

@cherrypy.tools.params(exception=ValueError)
def resource(self, limit: int):
    assert isinstance(limit, int) # a ValueError would have already raised a 400
@jaraco jaraco closed this as completed in c060b46 Jul 19, 2016
jaraco added a commit that referenced this issue Jul 19, 2016
Convert request params based on function annotations.  Fixes #1441.
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

No branches or pull requests

1 participant