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

Force aiohttp.web handlers to coroutines #186

Closed
asvetlov opened this issue Dec 4, 2014 · 8 comments
Closed

Force aiohttp.web handlers to coroutines #186

asvetlov opened this issue Dec 4, 2014 · 8 comments
Labels

Comments

@asvetlov
Copy link
Member

asvetlov commented Dec 4, 2014

Now handler may be a regular function.

I guess to stop support for this behavior and raise an exception in router.add_route() if non-coroutine has passed.

@fafhrd91 you have guessed this earlier, do you agree with proposed change now?

@fafhrd91
Copy link
Member

fafhrd91 commented Dec 4, 2014

i actually like that you can use normal function as handler.

@kxepal @popravich ?

@asvetlov
Copy link
Member Author

asvetlov commented Dec 4, 2014

I'll probably publish PR for middlewares at this weekend.
Middleware implementation may be easier with coroutines-only.

@fafhrd91
Copy link
Member

fafhrd91 commented Dec 4, 2014

how about wrapping non-coroutine handlers into coroutine inside add_route then?

@ludovic-gasc
Copy link
Contributor

+1 for coroutines only.
In API-Hour, I'd authorised a mix of coroutines and simple functions.
Finally, after several real world projects with my colleagues, we replace more and more simple functions by coroutines.

@asvetlov
Copy link
Member Author

asvetlov commented Dec 4, 2014

I'm ok with automatic converting in router.add_route().

@popravich
Copy link
Member

+1 for automatic converting.
In our tests we use mock-server which just returns prepared answers so its handlers are just functions.
This way it more readable and simple to understand.

@asvetlov
Copy link
Member Author

asvetlov commented Dec 7, 2014

Done

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants