Improve docs of URLSpec capturing groups
Inspired by https://groups.google.com/d/msg/python-tornado/eQ3wyusHCio/4eVVANYxAAAJ
This commit is contained in:
parent
02dc4f7a18
commit
759ac2df1e
|
@ -25,6 +25,11 @@
|
|||
These methods can be made asynchronous with one of the following
|
||||
decorators: `.gen.coroutine`, `.return_future`, or `asynchronous`.
|
||||
|
||||
The arguments to these methods come from the `.URLSpec`: Any
|
||||
capturing groups in the regular expression become arguments to the
|
||||
HTTP verb methods (keyword arguments if the group is named,
|
||||
positional arguments if its unnamed).
|
||||
|
||||
To support a method not on this list, override the class variable
|
||||
``SUPPORTED_METHODS``::
|
||||
|
||||
|
|
|
@ -2967,9 +2967,11 @@ class URLSpec(object):
|
|||
def __init__(self, pattern, handler, kwargs=None, name=None):
|
||||
"""Parameters:
|
||||
|
||||
* ``pattern``: Regular expression to be matched. Any groups
|
||||
in the regex will be passed in to the handler's get/post/etc
|
||||
methods as arguments.
|
||||
* ``pattern``: Regular expression to be matched. Any capturing
|
||||
groups in the regex will be passed in to the handler's
|
||||
get/post/etc methods as arguments (by keyword if named, by
|
||||
position if unnamed. Named and unnamed capturing groups may
|
||||
may not be mixed in the same rule).
|
||||
|
||||
* ``handler``: `RequestHandler` subclass to be invoked.
|
||||
|
||||
|
@ -2978,6 +2980,7 @@ class URLSpec(object):
|
|||
|
||||
* ``name`` (optional): A name for this handler. Used by
|
||||
`Application.reverse_url`.
|
||||
|
||||
"""
|
||||
if not pattern.endswith('$'):
|
||||
pattern += '$'
|
||||
|
|
Loading…
Reference in New Issue