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()`. 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 ("