]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Document RequestHandler.patch.
authorBen Darnell <ben@bendarnell.com>
Sun, 10 May 2015 01:55:00 +0000 (21:55 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 10 May 2015 01:55:00 +0000 (21:55 -0400)
Add an example for overriding SUPPORTED_METHODS.

docs/web.rst
tornado/web.py

index 0e4987a9a501343baa6a7143b8183983723386eb..c969724783c2aea287a608da6516f992c4e01ccf 100644 (file)
    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
index 9bc12933f8e601b985e0e790f66240b4b76b6d58..0a50f79357fb338f4f43088b6abafe79ae2a51cf 100644 (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.
+    """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")