arguments, just like `~.RequestHandler.clear_cookie`.
* The embedded ``ca-certificats.crt`` file has been updated with the current
Mozilla CA list.
-* `.GoogleOAuth2Mixin` has been added so that Google's OAuth2 only apps are able to get a context without OpenID (which uses OAuth 1).
+* `.GoogleOAuth2Mixin` has been added so that Google's OAuth2 only apps are
+ able to get a context without OpenID (which uses OAuth 1).
+* `.WebSocketHandler.write_message` now raises `.WebSocketClosedError` instead
+ of `AttributeError` when the connection has been closed.
+* ``simple_httpclient`` now applies the ``connect_timeout`` to requests
+ that are queued and have not yet started.
+* `.is_valid_ip` (and therefore ``HTTPRequest.remote_ip``) now rejects
+ empty strings.
+* `.websocket_connect` now accepts preconstructed ``HTTPRequest`` objects.
+* Fix a bug with `.WebSocketHandler` when used with some proxies that
+ unconditionally modify the ``Connection`` header.
+* New application setting ``default_handler_class`` can be used to easily
+ set up custom 404 pages.
+* Fix some error messages for unix sockets (and other non-IP sockets)
+* New application settings ``autoreload``, ``compiled_template_cache``,
+ ``static_hash_cache``, and ``serve_traceback`` can be used to control
+ individual aspects of debug mode.
+* New methods `.RequestHandler.get_query_argument` and
+ `.RequestHandler.get_body_argument` and new attributes
+ `.HTTPRequest.query_arguments` and `.HTTPRequest.body_arguments` allow access
+ to arguments without intermingling those from the query string with those
+ from the request body.
+* `.websocket_connect` now returns an error immediately for refused connections
+ instead of waiting for the timeout.
+* Exceptions will no longer be logged twice when using both ``@asynchronous``
+ and ``@gen.coroutine``
+* Swallow a spurious exception from ``set_nodelay`` when a connection
+ has been reset.
+* Coroutines may now yield dicts in addition to lists to wait for
+ multiple tasks in parallel.
+* Fix an error from `tornado.log.enable_pretty_logging` when
+ `sys.stderr` does not have an ``isatty`` method.
+* `.WebSocketClientConnection` now has a ``close`` method.
+* It is now possible to specify handlers by name when using the `.URLSpec`
+ class.
+* On Python 2.6, ``simple_httpclient`` now uses TLSv1 instead of SSLv3.
+* Added `.GoogleOAuth2Mixin` support authentication to Google services
+ with OAuth 2 instead of OpenID and OAuth 1.
+* TODO: document asyncio and C extension module.
General settings:
- * ``debug``: If ``True`` the application runs in debug mode,
- described in :ref:`debug-mode`.
+ * ``autoreload``: If ``True``, the server process will restart
+ when any source files change, as described in :ref:`debug-mode`.
+ This option is new in Tornado 3.2; previously this functionality
+ was controlled by the ``debug`` setting.
+ * ``debug``: Shorthand for several debug mode settings,
+ described in :ref:`debug-mode`. Setting ``debug=True`` is
+ equivalent to ``autoreload=True``, ``compiled_template_cache=False``,
+ ``static_hash_cache=False``, ``serve_traceback=True``.
+ * ``default_handler_class`` and ``default_handler_args``:
+ This handler will be used if no other match is found;
+ use this to implement custom 404 pages (new in Tornado 3.2).
* ``gzip``: If ``True``, responses in textual formats will be
gzipped automatically.
* ``log_function``: This function will be called at the end
`RequestHandler` object). The default implementation
writes to the `logging` module's root logger. May also be
customized by overriding `Application.log_request`.
+ * ``serve_traceback``: If true, the default error page
+ will include the traceback of the error. This option is new in
+ Tornado 3.2; previously this functionality was controlled by
+ the ``debug`` setting.
* ``ui_modules`` and ``ui_methods``: May be set to a mapping
of `UIModule` or UI methods to be made available to templates.
May be set to a module, dictionary, or a list of modules
of a function that all output should be passed through.
Defaults to ``"xhtml_escape"``. Can be changed on a per-template
basis with the ``{% autoescape %}`` directive.
+ * ``compiled_template_cache``: Default is ``True``; if ``False``
+ templates will be recompiled on every request. This option
+ is new in Tornado 3.2; previously this functionality was controlled
+ by the ``debug`` setting.
* ``template_path``: Directory containing template files. Can be
further customized by overriding `RequestHandler.get_template_path`
* ``template_loader``: Assign to an instance of
Static file settings:
+ * ``static_hash_cache``: Default is ``True``; if ``False``
+ static urls will be recomputed on every request. This option
+ is new in Tornado 3.2; previously this functionality was controlled
+ by the ``debug`` setting.
* ``static_path``: Directory from which static files will be
served.
* ``static_url_prefix``: Url prefix for static files,
.. automethod:: WebSocketHandler.async_callback
.. automethod:: WebSocketHandler.ping
.. automethod:: WebSocketHandler.on_pong
+ .. autoexception:: WebSocketClosedError
Client-side support
response3 = response_dict['response3']
response4 = response_dict['response4']
+.. versionchanged:: 3.2
+ Dict support added.
+
For more complicated interfaces, `Task` can be split into two parts:
`Callback` and `Wait`::
`.RequestHandler.get_argument`, which returns argument values as
unicode strings.
+ .. attribute:: query_arguments
+
+ Same format as ``arguments``, but contains only arguments extracted
+ from the query string.
+
+ .. versionadded:: 3.2
+
+ .. attribute:: body_arguments
+
+ Same format as ``arguments``, but contains only arguments extracted
+ from the request body.
+
+ .. versionadded:: 3.2
+
.. attribute:: files
File uploads are available in the files property, which maps file
last value.
The returned value is always unicode.
+
+ .. versionadded:: 3.2
"""
return self._get_argument(name, default, self.request.body_arguments, strip)
If the argument is not present, returns an empty list.
The returned values are always unicode.
+
+ .. versionadded:: 3.2
"""
return self._get_arguments(name, self.request.body_arguments, strip)
last value.
The returned value is always unicode.
+
+ .. versionadded:: 3.2
"""
return self._get_argument(name, default, self.request.query_arguments, strip)
If the argument is not present, returns an empty list.
The returned values are always unicode.
+
+ .. versionadded:: 3.2
"""
return self._get_arguments(name, self.request.query_arguments, strip)
assert len(self.regex.groupindex) in (0, self.regex.groups), \
("groups in url regexes must either be all named or all "
"positional: %r" % self.regex.pattern)
-
+
if isinstance(handler, str):
# import the Module and instantiate the class
# Must be a fully qualified name (module.ClassName)
handler = import_object(handler)
-
+
self.handler_class = handler
self.kwargs = kwargs or {}
self.name = name
class WebSocketClosedError(WebSocketError):
+ """Raised by operations on a closed connection.
+
+ .. versionadded:: 3.2
+ """
pass
encoded as json). If the ``binary`` argument is false, the
message will be sent as utf8; in binary mode any byte string
is allowed.
+
+ If the connection is already closed, raises `WebSocketClosedError`.
+
+ .. versionchanged:: 3.2
+ `WebSocketClosedError` was added (previously a closed connection
+ would raise an `AttributeError`)
"""
if self.ws_connection is None:
raise WebSocketClosedError()
104857600, self.resolver)
def close(self):
- """Closes the websocket connection."""
+ """Closes the websocket connection.
+
+ .. versionadded:: 3.2
+ """
if self.protocol is not None:
self.protocol.close()
self.protocol = None
Takes a url and returns a Future whose result is a
`WebSocketClientConnection`.
+
+ .. versionchanged:: 3.2
+ Also accepts ``HTTPRequest`` objects in place of urls.
"""
if io_loop is None:
io_loop = IOLoop.current()