From e0dbab42d162a7462011c3a0e8b14e5343862031 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Fri, 10 Nov 2017 10:01:12 +0200 Subject: [PATCH 1/2] Drop deprecated route.url() --- aiohttp/web_urldispatcher.py | 49 ------------------ docs/web_reference.rst | 13 ----- tests/test_urldispatch.py | 90 ++++++++------------------------- tests/test_web_urldispatcher.py | 2 - 4 files changed, 21 insertions(+), 133 deletions(-) diff --git a/aiohttp/web_urldispatcher.py b/aiohttp/web_urldispatcher.py index 827dfb2ef4c..6cdf604e9d1 100644 --- a/aiohttp/web_urldispatcher.py +++ b/aiohttp/web_urldispatcher.py @@ -66,17 +66,6 @@ def __init__(self, *, name=None): def name(self): return self._name - @abc.abstractmethod # pragma: no branch - def url(self, **kwargs): - """Construct url for resource with additional params. - - Deprecated, use url_for() instead. - - """ - warnings.warn(".url(...) is deprecated, use .url_for instead", - DeprecationWarning, - stacklevel=3) - @abc.abstractmethod # pragma: no branch def url_for(self, **kwargs): """Construct url for resource with additional params.""" @@ -171,17 +160,6 @@ def get_info(self): def url_for(self, *args, **kwargs): """Construct url for route with additional params.""" - @abc.abstractmethod # pragma: no branch - def url(self, **kwargs): - """Construct url for resource with additional params. - - Deprecated, use url_for() instead. - - """ - warnings.warn(".url(...) is deprecated, use .url_for instead", - DeprecationWarning, - stacklevel=3) - async def handle_expect_header(self, request): return await self._expect_handler(request) @@ -334,10 +312,6 @@ def _match(self, path): def get_info(self): return {'path': self._path} - def url(self, *, query=None): - super().url() - return str(self.url_for().with_query(query)) - def url_for(self): return URL(self._path) @@ -411,10 +385,6 @@ def url_for(self, **parts): url = self._formatter.format_map(parts) return URL(url) - def url(self, *, parts, query=None): - super().url(**parts) - return str(self.url_for(**parts).with_query(query)) - def __repr__(self): name = "'" + self.name + "' " if self.name is not None else "" return (" Date: Fri, 10 Nov 2017 10:02:41 +0200 Subject: [PATCH 2/2] Add changelog --- CHANGES/2501.removal | 1 + 1 file changed, 1 insertion(+) create mode 100644 CHANGES/2501.removal diff --git a/CHANGES/2501.removal b/CHANGES/2501.removal new file mode 100644 index 00000000000..1039b8a0e0b --- /dev/null +++ b/CHANGES/2501.removal @@ -0,0 +1 @@ +Drop deprecated `resource.url()`.