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

DeprecationWarning: router argument is deprecated #3387

Closed
rob-blackbourn opened this issue Nov 9, 2018 · 5 comments
Closed

DeprecationWarning: router argument is deprecated #3387

rob-blackbourn opened this issue Nov 9, 2018 · 5 comments
Labels

Comments

@rob-blackbourn
Copy link

Fantastic project!

I have a project aiohttp-route-middleware which uses the router parameter on the aiohttp.web.Application class constructor.

from aiohttp import web
from aiohttp_route_middleware import UrlDispatcherEx
app = web.Application(router=UrlDispatcherEx())

I've just noticed this parameter has become deprecated.

What should I do instead?

Thanks,

Rob

@aio-libs-bot
Copy link

GitMate.io thinks the contributor most likely able to help you is @asvetlov.

Possibly related issues are #1108 (Deprecate aiohttp.wsgi), #1615 (Chunk size is deprecated), #1137 (Improve router performance), #986 (Implement router shortcuts), and #3260 (Deprecate stream.unread_data).

@aio-libs-bot aio-libs-bot added bug question StackOverflow labels Nov 9, 2018
@asvetlov
Copy link
Member

asvetlov commented Nov 9, 2018

If you need some pre and post processing for specific web-handler -- please do it explicitly.
There are many techniques: direct calls, function decorators etc.
Middlewares are supposed to work on application level; this design is common for very many HTTP frameworks -- doesn't matter if these frameworks are async or not.

@rob-blackbourn
Copy link
Author

Hi @asvetlov,

There good thing about standards is there are so many to choose from :)

The way aiohttp does middleware is very much like ASP.Net core, but this has the limitations I discuss in the README of my project (but maybe I have just misunderstood?).

I was trying to achieve one of the patterns expressjs supports: routed middleware.

I can certainly find a work-around (I guess a decorator would be quite elegant), but it would be a shame to loose this feature. What is the motivation for deprecating it?

Rob

@asvetlov
Copy link
Member

asvetlov commented Nov 9, 2018

Please read #2766

@lock
Copy link

lock bot commented Nov 11, 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 Nov 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 11, 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

3 participants