@@ -1826,6 +1826,13 @@ Resource classes hierarchy::
1826
1826
1827
1827
Read-only *name * of resource or ``None ``.
1828
1828
1829
+ .. attribute :: canonical
1830
+
1831
+ Read-only *canonical path * associate with the resource. For example
1832
+ ``/path/to `` or ``/path/{to} ``
1833
+
1834
+ .. versionadded :: 3.3
1835
+
1829
1836
.. comethod :: resolve(request)
1830
1837
1831
1838
Resolve resource by finding appropriate :term: `web-handler ` for
@@ -1889,6 +1896,12 @@ Resource classes hierarchy::
1889
1896
The class corresponds to resources with plain-text matching,
1890
1897
``'/path/to' `` for example.
1891
1898
1899
+ .. attribute :: canonical
1900
+
1901
+ Read-only *canonical path * associate with the resource. Returns the path
1902
+ used to create the PlainResource. For example ``/path/to ``
1903
+
1904
+ .. versionadded :: 3.3
1892
1905
1893
1906
.. method :: url_for()
1894
1907
@@ -1903,6 +1916,13 @@ Resource classes hierarchy::
1903
1916
:ref: `variable <aiohttp-web-variable-handler >` matching,
1904
1917
e.g. ``'/path/{to}/{param}' `` etc.
1905
1918
1919
+ .. attribute :: canonical
1920
+
1921
+ Read-only *canonical path * associate with the resource. Returns the
1922
+ formatter obtained from the path used to create the DynamicResource.
1923
+ For example, from a path ``/get/{num:^\d+} ``, it returns ``/get/{num} ``
1924
+
1925
+ .. versionadded :: 3.3
1906
1926
1907
1927
.. method :: url_for(**params)
1908
1928
@@ -1921,6 +1941,13 @@ Resource classes hierarchy::
1921
1941
The class corresponds to resources for :ref: `static file serving
1922
1942
<aiohttp-web-static-file-handling>`.
1923
1943
1944
+ .. attribute :: canonical
1945
+
1946
+ Read-only *canonical path * associate with the resource. Returns the prefix
1947
+ used to create the StaticResource. For example ``/prefix ``
1948
+
1949
+ .. versionadded :: 3.3
1950
+
1924
1951
.. method :: url_for(filename, append_version=None)
1925
1952
1926
1953
Returns a :class: `~yarl.URL ` for file path under resource prefix.
@@ -1948,6 +1975,14 @@ Resource classes hierarchy::
1948
1975
A resource for serving nested applications. The class instance is
1949
1976
returned by :class: `~aiohttp.web.Application.add_subapp ` call.
1950
1977
1978
+ .. attribute :: canonical
1979
+
1980
+ Read-only *canonical path * associate with the resource. Returns the
1981
+ prefix used to create the PrefixedSubAppResource.
1982
+ For example ``/prefix ``
1983
+
1984
+ .. versionadded :: 3.3
1985
+
1951
1986
.. method :: url_for(**kwargs)
1952
1987
1953
1988
The call is not allowed, it raises :exc: `RuntimeError `.
0 commit comments