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 Views in Flask-style decorators (RouteTableDef) #2472

Closed
socketpair opened this issue Nov 6, 2017 · 8 comments
Closed

Support Views in Flask-style decorators (RouteTableDef) #2472

socketpair opened this issue Nov 6, 2017 · 8 comments
Labels
Milestone

Comments

@socketpair
Copy link
Contributor

@socketpair socketpair commented Nov 6, 2017

@asvetlov asvetlov added this to the 3.0 milestone Nov 7, 2017
@asvetlov asvetlov mentioned this issue Nov 7, 2017
@pfreixes
Copy link
Contributor

@pfreixes pfreixes commented Nov 18, 2017

I was taking a look at that and looks hard to give a 100% of consistency between decorators and views. Likely the best way to give support for decorating views is creating a new ad-hoc method called view, see the following example:

routes = web.RouteTableDef()

@routes.view('/view')
class MyView(web.View):
    async def get(self):
        return await get_resp(self.request)

    async def post(self):
        return await post_resp(self.request)

Thoughts @asvetlov @socketpair?

@asvetlov
Copy link
Member

@asvetlov asvetlov commented Nov 19, 2017

Brilliant idea.
Let's add web.view function and router.add_view() too -- in this case everything should interconnect smoothly.

@sheb
Copy link
Contributor

@sheb sheb commented Dec 14, 2017

Is anyone working on this ?

@asvetlov
Copy link
Member

@asvetlov asvetlov commented Dec 14, 2017

AFAIK nobody.

@pfreixes
Copy link
Contributor

@pfreixes pfreixes commented Dec 14, 2017

@sheb
Copy link
Contributor

@sheb sheb commented Dec 15, 2017

Ok I'll take care of it.
PR maybe this week-end

@asvetlov
Copy link
Member

@asvetlov asvetlov commented Dec 16, 2017

Fixed by #2611

@asvetlov asvetlov closed this Dec 16, 2017
@lock
Copy link

@lock lock bot commented Oct 28, 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].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

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

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.