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

fixed type annotation in method add_view in UrlDispatcher #3880

Merged
merged 3 commits into from
Jul 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES/3880.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed type annotation for add_view method of UrlDispatcher to accept any subclass of View
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Igor Alexandrov
Igor Davydenko
Igor Mozharovsky
Igor Pavlov
Ilya Chichak
Ingmar Steen
Ivan Larin
Jacob Champion
Expand Down
3 changes: 2 additions & 1 deletion aiohttp/web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Set,
Sized,
Tuple,
Type,
Union,
cast,
)
Expand Down Expand Up @@ -1112,7 +1113,7 @@ def add_delete(self, path: str, handler: _WebHandler,
"""
return self.add_route(hdrs.METH_DELETE, path, handler, **kwargs)

def add_view(self, path: str, handler: AbstractView,
def add_view(self, path: str, handler: Type[AbstractView],
**kwargs: Any) -> AbstractRoute:
"""
Shortcut for add_route with ANY methods for a class-based view
Expand Down