Skip to content

Commit

Permalink
Document RequestHandler.patch.
Browse files Browse the repository at this point in the history
Add an example for overriding SUPPORTED_METHODS.
  • Loading branch information
bdarnell committed May 10, 2015
1 parent 2c401cf commit 01c78eb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions docs/web.rst
Expand Up @@ -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.head
.. automethod:: RequestHandler.post
.. automethod:: RequestHandler.put
.. automethod:: RequestHandler.delete
.. automethod:: RequestHandler.head
.. automethod:: RequestHandler.patch
.. automethod:: RequestHandler.put
.. automethod:: RequestHandler.options

Input
Expand Down
8 changes: 4 additions & 4 deletions tornado/web.py
Expand Up @@ -144,12 +144,12 @@ def get(self):
.. versionadded:: 3.2.1
"""


class RequestHandler(object):
"""Subclass this class and define `get()` or `post()` to make a handler.
"""Base class for HTTP request handlers.
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.
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")
Expand Down

0 comments on commit 01c78eb

Please sign in to comment.