-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add path_pattern property to routes and resources #2993
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Add canonical property to resources |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1823,6 +1823,13 @@ Resource classes hierarchy:: | |
|
||
Read-only *name* of resource or ``None``. | ||
|
||
.. attribute:: canonical | ||
|
||
Read-only *canonical path* associate with the resource. For example | ||
``/path/to`` or ``/path/{to}`` | ||
|
||
.. versionadded:: 3.3 | ||
|
||
.. comethod:: resolve(request) | ||
|
||
Resolve resource by finding appropriate :term:`web-handler` for | ||
|
@@ -1886,6 +1893,12 @@ Resource classes hierarchy:: | |
The class corresponds to resources with plain-text matching, | ||
``'/path/to'`` for example. | ||
|
||
.. attribute:: canonical | ||
|
||
Read-only *canonical path* associate with the resource. Returns the path | ||
used to create the PlainResource. For example ``/path/to`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.. versionadded:: 3.3 | ||
|
||
.. method:: url_for() | ||
|
||
|
@@ -1900,6 +1913,13 @@ Resource classes hierarchy:: | |
:ref:`variable <aiohttp-web-variable-handler>` matching, | ||
e.g. ``'/path/{to}/{param}'`` etc. | ||
|
||
.. attribute:: canonical | ||
|
||
Read-only *canonical path* associate with the resource. Returns the | ||
formatter obtained from the path used to create the DynamicResource. | ||
For example, from a path ``/get/{num:^\d+}``, it returns ``/get/{num}`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
.. versionadded:: 3.3 | ||
|
||
.. method:: url_for(**params) | ||
|
||
|
@@ -1918,6 +1938,13 @@ Resource classes hierarchy:: | |
The class corresponds to resources for :ref:`static file serving | ||
<aiohttp-web-static-file-handling>`. | ||
|
||
.. attribute:: canonical | ||
|
||
Read-only *canonical path* associate with the resource. Returns the prefix | ||
used to create the StaticResource. For example ``/prefix`` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.. versionadded:: 3.3 | ||
|
||
.. method:: url_for(filename, append_version=None) | ||
|
||
Returns a :class:`~yarl.URL` for file path under resource prefix. | ||
|
@@ -1945,6 +1972,14 @@ Resource classes hierarchy:: | |
A resource for serving nested applications. The class instance is | ||
returned by :class:`~aiohttp.web.Application.add_subapp` call. | ||
|
||
.. attribute:: canonical | ||
|
||
Read-only *canonical path* associate with the resource. Returns the | ||
prefix used to create the PrefixedSubAppResource. | ||
For example ``/prefix`` | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
.. versionadded:: 3.3 | ||
|
||
.. method:: url_for(**kwargs) | ||
|
||
The call is not allowed, it raises :exc:`RuntimeError`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.. versionadded:: 3.3