Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed Sep 22, 2015
1 parent 8047648 commit 26e8b1e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/web.rst
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@ so application developer can use classes if he wants::
That means the handler for ``'/path'`` is applied for every HTTP method.


Route views
-----------

.. versionadded:: 0.18

For look on *all* routes in the router you may use
:meth:`UrlDispatcher.routes` method.

You can iterate over routes in the router table::

for route in app.router.routes():
print(route)

or get router table size::

len(app.router.routes())



Custom conditions for routes lookup
-----------------------------------

Expand Down
20 changes: 20 additions & 0 deletions docs/web_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,26 @@ Router is any object that implements :class:`AbstractRouter` interface.
The method don't raise :exc:`HTTPNotFound` and
:exc:`HTTPMethodNotAllowed` anymore.

.. method:: routes()

The method returns a *view* for *all* registered routes.

The view is an object that allows to:

1. Get size of the router table::

len(app.router.routes())

2. Iterate over registered routes::

for route in app.router.routes():
print(route)

3. Make a check if the route is registered in the router table::

route in app.router.routes()

.. versionadded:: 0.18

.. _aiohttp-web-route:

Expand Down

0 comments on commit 26e8b1e

Please sign in to comment.