Document RequestHandler.patch.

Add an example for overriding SUPPORTED_METHODS.
This commit is contained in:
Ben Darnell 2015-05-09 21:55:00 -04:00
parent 2c401cf7ff
commit 01c78ebfcc
2 changed files with 18 additions and 8 deletions

View File

@ -25,11 +25,21 @@
These methods can be made asynchronous with one of the following
decorators: `.gen.coroutine`, `.return_future`, or `asynchronous`.
To support a method not on this list, override the class variable
``SUPPORTED_METHODS``::
class WebDAVHandler(RequestHandler):
SUPPORTED_METHODS = RequestHandler.SUPPORTED_METHODS + ('PROPFIND',)
def propfind(self):
pass
.. automethod:: RequestHandler.get
.. automethod:: RequestHandler.post
.. automethod:: RequestHandler.put
.. automethod:: RequestHandler.delete
.. automethod:: RequestHandler.head
.. automethod:: RequestHandler.post
.. automethod:: RequestHandler.delete
.. automethod:: RequestHandler.patch
.. automethod:: RequestHandler.put
.. automethod:: RequestHandler.options
Input

View File

@ -144,12 +144,12 @@ May be overridden by passing a ``min_version`` keyword argument.
.. versionadded:: 3.2.1
"""
class RequestHandler(object):
"""Subclass this class and define `get()` or `post()` to make a handler.
If you want to support more methods than the standard GET/HEAD/POST, you
should override the class variable ``SUPPORTED_METHODS`` in your
`RequestHandler` subclass.
class RequestHandler(object):
"""Base class for HTTP request handlers.
Subclasses must define at least one of the methods defined in the
"Entry points" section below.
"""
SUPPORTED_METHODS = ("GET", "HEAD", "POST", "DELETE", "PATCH", "PUT",
"OPTIONS")