def tornado.web._create_signature_v1 | ( | secret, | |
parts | |||
) | [private] |
def tornado.web._create_signature_v2 | ( | secret, | |
s | |||
) | [private] |
def tornado.web._decode_signed_value_v1 | ( | secret, | |
name, | |||
value, | |||
max_age_days, | |||
clock | |||
) | [private] |
def tornado.web._decode_signed_value_v2 | ( | secret, | |
name, | |||
value, | |||
max_age_days, | |||
clock | |||
) | [private] |
def tornado.web._has_stream_request_body | ( | cls | ) | [private] |
def tornado.web._time_independent_equals | ( | a, | |
b | |||
) | [private] |
def tornado.web._unquote_or_none | ( | s | ) | [private] |
def tornado.web.addslash | ( | method | ) |
Use this decorator to add a missing trailing slash to the request path. For example, a request to ``/foo`` would redirect to ``/foo/`` with this decorator. Your request handler mapping should use a regular expression like ``r'/foo/?'`` in conjunction with using the decorator.
def tornado.web.asynchronous | ( | method | ) |
Wrap request handler methods with this if they are asynchronous. This decorator is unnecessary if the method is also decorated with ``@gen.coroutine`` (it is legal but unnecessary to use the two decorators together, in which case ``@asynchronous`` must be first). This decorator should only be applied to the :ref:`HTTP verb methods <verbs>`; its behavior is undefined for any other method. This decorator does not *make* a method asynchronous; it tells the framework that the method *is* asynchronous. For this decorator to be useful the method must (at least sometimes) do something asynchronous. If this decorator is given, the response is not finished when the method returns. It is up to the request handler to call `self.finish() <RequestHandler.finish>` to finish the HTTP request. Without this decorator, the request is automatically finished when the ``get()`` or ``post()`` method returns. Example:: class MyRequestHandler(web.RequestHandler): @web.asynchronous def get(self): http = httpclient.AsyncHTTPClient() http.fetch("http://friendfeed.com/", self._on_download) def _on_download(self, response): self.write("Downloaded!") self.finish() .. versionadded:: 3.1 The ability to use ``@gen.coroutine`` without ``@asynchronous``.
def tornado.web.authenticated | ( | method | ) |
Decorate methods with this to require that the user be logged in. If the user is not logged in, they will be redirected to the configured `login url <RequestHandler.get_login_url>`. If you configure a login url with a query parameter, Tornado will assume you know what you're doing and use it as-is. If not, it will add a `next` parameter so the login page knows where to send you once you're logged in.
def tornado.web.create_signed_value | ( | secret, | |
name, | |||
value, | |||
version = None , |
|||
clock = None |
|||
) |
def tornado.web.decode_signed_value | ( | secret, | |
name, | |||
value, | |||
max_age_days = 31 , |
|||
clock = None , |
|||
min_version = None |
|||
) |
def tornado.web.removeslash | ( | method | ) |
Use this decorator to remove trailing slashes from the request path. For example, a request to ``/foo/`` would redirect to ``/foo`` with this decorator. Your request handler mapping should use a regular expression like ``r'/foo/*'`` in conjunction with using the decorator.
def tornado.web.stream_request_body | ( | cls | ) |
Apply to `RequestHandler` subclasses to enable streaming body support. This decorator implies the following changes: * `.HTTPServerRequest.body` is undefined, and body arguments will not be included in `RequestHandler.get_argument`. * `RequestHandler.prepare` is called when the request headers have been read instead of after the entire body has been read. * The subclass must define a method ``data_received(self, data):``, which will be called zero or more times as data is available. Note that if the request has an empty body, ``data_received`` may not be called. * ``prepare`` and ``data_received`` may return Futures (such as via ``@gen.coroutine``, in which case the next method will not be called until those futures have completed. * The regular HTTP method (``post``, ``put``, etc) will be called after the entire body has been read. There is a subtle interaction between ``data_received`` and asynchronous ``prepare``: The first call to ``data_recieved`` may occur at any point after the call to ``prepare`` has returned *or yielded*.
tuple tornado::web::_signed_value_version_re = re.compile(br"^([1-9][0-9]*)\|(.*)$") |
tornado::web::_time_independent_equals = hmac.compare_digest |