2013-03-29 13:01:44 +00:00
|
|
|
What's new in Tornado 3.0
|
|
|
|
=========================
|
2012-09-08 19:49:22 +00:00
|
|
|
|
2013-03-29 13:01:44 +00:00
|
|
|
Mar 29, 2013
|
|
|
|
------------
|
2012-09-08 19:49:22 +00:00
|
|
|
|
2013-03-04 03:47:30 +00:00
|
|
|
Highlights
|
|
|
|
^^^^^^^^^^
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* The ``callback`` argument to many asynchronous methods is now
|
2013-03-17 17:42:12 +00:00
|
|
|
optional, and these methods return a `.Future`. The `tornado.gen`
|
|
|
|
module now understands ``Futures``, and these methods can be used
|
|
|
|
directly without a `.gen.Task` wrapper.
|
2013-03-16 03:29:42 +00:00
|
|
|
* New function `.IOLoop.current` returns the `.IOLoop` that is running
|
|
|
|
on the current thread (as opposed to `.IOLoop.instance`, which
|
2013-03-04 03:47:30 +00:00
|
|
|
returns a specific thread's (usually the main thread's) IOLoop.
|
|
|
|
* New class `tornado.netutil.Resolver` provides an asynchronous
|
|
|
|
interface to DNS resolution. The default implementation is still
|
|
|
|
blocking, but non-blocking implementations are available using one
|
|
|
|
of three optional dependencies: `~tornado.netutil.ThreadedResolver`
|
|
|
|
using the `concurrent.futures` thread pool,
|
2013-03-16 03:29:42 +00:00
|
|
|
``tornado.platform.caresresolver.CaresResolver`` using the ``pycares``
|
|
|
|
library, or ``tornado.platform.twisted.TwistedResolver`` using ``twisted``
|
2013-03-04 03:47:30 +00:00
|
|
|
* Tornado's logging is now less noisy, and it no longer goes directly
|
|
|
|
to the root logger, allowing for finer-grained configuration.
|
|
|
|
* New class `tornado.process.Subprocess` wraps `subprocess.Popen` with
|
2013-03-16 03:29:42 +00:00
|
|
|
`.PipeIOStream` access to the child's file descriptors.
|
2013-03-16 22:52:07 +00:00
|
|
|
* `.IOLoop` now has a static `configure <.Configurable.configure>`
|
|
|
|
method like the one on `.AsyncHTTPClient`, which can be used to
|
|
|
|
select an `.IOLoop` implementation other than the default.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.IOLoop` can now optionally use a monotonic clock if available
|
2013-03-04 03:47:30 +00:00
|
|
|
(see below for more details).
|
|
|
|
|
|
|
|
|
|
|
|
Backwards-incompatible changes
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
* Python 2.5 is no longer supported. Python 3 is now supported in a single
|
|
|
|
codebase instead of using ``2to3``
|
2013-03-10 20:24:38 +00:00
|
|
|
* The ``tornado.database`` module has been removed. It is now available
|
2013-03-04 03:47:30 +00:00
|
|
|
as a separate package, `torndb <https://github.com/bdarnell/torndb>`_
|
|
|
|
* Functions that take an ``io_loop`` parameter now default to
|
2013-03-16 03:29:42 +00:00
|
|
|
`.IOLoop.current()` instead of `.IOLoop.instance()`.
|
2013-03-04 03:47:30 +00:00
|
|
|
* Empty HTTP request arguments are no longer ignored. This applies to
|
|
|
|
``HTTPRequest.arguments`` and ``RequestHandler.get_argument[s]``
|
|
|
|
in WSGI and non-WSGI modes.
|
2013-03-10 02:43:11 +00:00
|
|
|
* On Python 3, `tornado.escape.json_encode` no longer accepts byte strings.
|
|
|
|
* On Python 3, the ``get_authenticated_user`` methods in `tornado.auth`
|
|
|
|
now return character strings instead of byte strings.
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``tornado.netutil.TCPServer`` has moved to its own module,
|
|
|
|
`tornado.tcpserver`.
|
2013-03-04 03:47:30 +00:00
|
|
|
* The Tornado test suite now requires ``unittest2`` when run on Python 2.6.
|
2013-03-31 21:44:22 +00:00
|
|
|
* `tornado.options.options` is no longer a subclass of `dict`; attribute-style
|
|
|
|
access is now required.
|
2013-03-04 03:47:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
Detailed changes by module
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
Multiple modules
|
|
|
|
~~~~~~~~~~~~~~~~
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2012-09-10 01:43:52 +00:00
|
|
|
* Tornado no longer logs to the root logger. Details on the new logging
|
|
|
|
scheme can be found under the `tornado.log` module. Note that in some
|
|
|
|
cases this will require that you add an explicit logging configuration
|
2012-12-15 02:15:53 +00:00
|
|
|
in order to see any output (perhaps just calling ``logging.basicConfig()``),
|
2013-03-16 03:29:42 +00:00
|
|
|
although both `.IOLoop.start()` and `tornado.options.parse_command_line`
|
2012-09-10 01:43:52 +00:00
|
|
|
will do this for you.
|
2013-01-26 18:33:52 +00:00
|
|
|
* On python 3.2+, methods that take an ``ssl_options`` argument (on
|
2013-03-16 03:29:42 +00:00
|
|
|
`.SSLIOStream`, `.TCPServer`, and `.HTTPServer`) now accept either a
|
2013-01-26 18:33:52 +00:00
|
|
|
dictionary of options or an `ssl.SSLContext` object.
|
|
|
|
* New optional dependency on `concurrent.futures` to provide better support
|
|
|
|
for working with threads. `concurrent.futures` is in the standard library
|
|
|
|
for Python 3.2+, and can be installed on older versions with
|
|
|
|
``pip install futures``.
|
|
|
|
|
|
|
|
`tornado.autoreload`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* `tornado.autoreload` is now more reliable when there are errors at import
|
|
|
|
time.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Calling `tornado.autoreload.start` (or creating an `.Application` with
|
|
|
|
``debug=True``) twice on the same `.IOLoop` now does nothing (instead of
|
2013-01-26 18:33:52 +00:00
|
|
|
creating multiple periodic callbacks). Starting autoreload on
|
2013-03-16 03:29:42 +00:00
|
|
|
more than one `.IOLoop` in the same process now logs a warning.
|
2013-02-27 03:53:46 +00:00
|
|
|
* Scripts run by autoreload no longer inherit ``__future__`` imports
|
|
|
|
used by Tornado.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.auth`
|
|
|
|
~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-10 02:43:11 +00:00
|
|
|
* On Python 3, the ``get_authenticated_user`` method family now returns
|
|
|
|
character strings instead of byte strings.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Asynchronous methods defined in `tornado.auth` now return a
|
2013-03-17 17:42:12 +00:00
|
|
|
`.Future`, and their ``callback`` argument is optional. The
|
|
|
|
``Future`` interface is preferred as it offers better error handling
|
|
|
|
(the previous interface just logged a warning and returned None).
|
2013-03-04 03:47:30 +00:00
|
|
|
* The `tornado.auth` mixin classes now define a method
|
|
|
|
``get_auth_http_client``, which can be overridden to use a non-default
|
2013-03-16 03:29:42 +00:00
|
|
|
`.AsyncHTTPClient` instance (e.g. to use a different `.IOLoop`)
|
|
|
|
* Subclasses of `.OAuthMixin` are encouraged to override
|
|
|
|
`.OAuthMixin._oauth_get_user_future` instead of ``_oauth_get_user``,
|
|
|
|
although both methods are still supported.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.concurrent`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* New module `tornado.concurrent` contains code to support working with
|
|
|
|
`concurrent.futures`, or to emulate future-based interface when that module
|
|
|
|
is not available.
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
``tornado.curl_httpclient``
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* Preliminary support for ``tornado.curl_httpclient`` on Python 3. The latest
|
2013-01-26 18:33:52 +00:00
|
|
|
official release of pycurl only supports Python 2, but Ubuntu has a
|
|
|
|
port available in 12.10 (``apt-get install python3-pycurl``). This port
|
|
|
|
currently has bugs that prevent it from handling arbitrary binary data
|
|
|
|
but it should work for textual (utf8) resources.
|
2013-02-27 03:53:46 +00:00
|
|
|
* Fix a crash with libcurl 7.29.0 if a curl object is created and closed
|
|
|
|
without being used.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-10 02:43:11 +00:00
|
|
|
`tornado.escape`
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* On Python 3, `~tornado.escape.json_encode` no longer accepts byte strings.
|
|
|
|
This mirrors the behavior of the underlying json module. Python 2 behavior
|
|
|
|
is unchanged but should be faster.
|
|
|
|
|
2013-01-26 18:33:52 +00:00
|
|
|
`tornado.gen`
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
2013-03-03 00:29:04 +00:00
|
|
|
* New decorator ``@gen.coroutine`` is available as an alternative to
|
2013-03-16 03:29:42 +00:00
|
|
|
``@gen.engine``. It automatically returns a
|
2013-03-17 17:42:12 +00:00
|
|
|
`.Future`, and within the function instead of
|
2013-03-16 03:29:42 +00:00
|
|
|
calling a callback you return a value with ``raise
|
|
|
|
gen.Return(value)`` (or simply ``return value`` in Python 3.3).
|
2013-03-17 17:42:12 +00:00
|
|
|
* Generators may now yield `.Future` objects.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Callbacks produced by `.gen.Callback` and `.gen.Task` are now automatically
|
2013-03-10 02:43:11 +00:00
|
|
|
stack-context-wrapped, to minimize the risk of context leaks when used
|
|
|
|
with asynchronous functions that don't do their own wrapping.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Fixed a memory leak involving generators, `.RequestHandler.flush`,
|
2013-03-04 03:47:30 +00:00
|
|
|
and clients closing connections while output is being written.
|
|
|
|
* Yielding a large list no longer has quadratic performance.
|
2013-03-03 00:29:04 +00:00
|
|
|
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.httpclient`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-17 17:42:12 +00:00
|
|
|
* `.AsyncHTTPClient.fetch` now returns a `.Future` and its callback argument
|
2013-03-04 03:47:30 +00:00
|
|
|
is optional. When the future interface is used, any error will be raised
|
2013-03-16 03:29:42 +00:00
|
|
|
automatically, as if `.HTTPResponse.rethrow` was called.
|
|
|
|
* `.AsyncHTTPClient.configure` and all `.AsyncHTTPClient` constructors
|
2013-01-26 18:33:52 +00:00
|
|
|
now take a ``defaults`` keyword argument. This argument should be a
|
|
|
|
dictionary, and its values will be used in place of corresponding
|
2013-03-16 03:29:42 +00:00
|
|
|
attributes of `~tornado.httpclient.HTTPRequest` that are not set.
|
|
|
|
* All unset attributes of `tornado.httpclient.HTTPRequest` are now
|
|
|
|
``None``. The default values of some attributes
|
|
|
|
(``connect_timeout``, ``request_timeout``, ``follow_redirects``,
|
|
|
|
``max_redirects``, ``use_gzip``, ``proxy_password``,
|
|
|
|
``allow_nonstandard_methods``, and ``validate_cert`` have been moved
|
|
|
|
from `~tornado.httpclient.HTTPRequest` to the client
|
|
|
|
implementations.
|
|
|
|
* The ``max_clients`` argument to `.AsyncHTTPClient` is now a keyword-only
|
2013-03-04 03:47:30 +00:00
|
|
|
argument.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Keyword arguments to `.AsyncHTTPClient.configure` are no longer used
|
2013-03-04 03:47:30 +00:00
|
|
|
when instantiating an implementation subclass directly.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Secondary `.AsyncHTTPClient` callbacks (``streaming_callback``,
|
2013-03-04 03:47:30 +00:00
|
|
|
``header_callback``, and ``prepare_curl_callback``) now respect
|
2013-03-16 03:29:42 +00:00
|
|
|
`.StackContext`.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.httpserver`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.HTTPServer` no longer logs an error when it is unable to read a second
|
2013-01-26 18:33:52 +00:00
|
|
|
request from an HTTP 1.1 keep-alive connection.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.HTTPServer` now takes a ``protocol`` keyword argument which can be set
|
2013-01-26 18:33:52 +00:00
|
|
|
to ``https`` if the server is behind an SSL-decoding proxy that does not
|
|
|
|
set any supported X-headers.
|
2014-02-23 20:57:18 +00:00
|
|
|
* ``tornado.httpserver.HTTPConnection`` now has a ``set_close_callback``
|
2013-01-26 18:33:52 +00:00
|
|
|
method that should be used instead of reaching into its ``stream``
|
|
|
|
attribute.
|
2012-09-10 04:04:58 +00:00
|
|
|
* Empty HTTP request arguments are no longer ignored. This applies to
|
|
|
|
``HTTPRequest.arguments`` and ``RequestHandler.get_argument[s]``
|
|
|
|
in WSGI and non-WSGI modes.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.ioloop`
|
|
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* New function `.IOLoop.current` returns the ``IOLoop`` that is running
|
|
|
|
on the current thread (as opposed to `.IOLoop.instance`, which returns a
|
2012-09-29 23:49:42 +00:00
|
|
|
specific thread's (usually the main thread's) IOLoop).
|
2013-03-16 03:29:42 +00:00
|
|
|
* New method `.IOLoop.add_future` to run a callback on the IOLoop when
|
2013-03-17 17:42:12 +00:00
|
|
|
an asynchronous `.Future` finishes.
|
2013-03-16 22:52:07 +00:00
|
|
|
* `.IOLoop` now has a static `configure <.Configurable.configure>`
|
|
|
|
method like the one on `.AsyncHTTPClient`, which can be used to
|
|
|
|
select an `.IOLoop` implementation other than the default.
|
2013-03-16 03:29:42 +00:00
|
|
|
* The `.IOLoop` poller implementations (``select``, ``epoll``, ``kqueue``)
|
|
|
|
are now available as distinct subclasses of `.IOLoop`. Instantiating
|
|
|
|
`.IOLoop` will continue to automatically choose the best available
|
2012-10-01 05:57:32 +00:00
|
|
|
implementation.
|
2013-03-16 03:29:42 +00:00
|
|
|
* The `.IOLoop` constructor has a new keyword argument ``time_func``,
|
2012-10-01 06:57:49 +00:00
|
|
|
which can be used to set the time function used when scheduling callbacks.
|
2013-03-16 03:29:42 +00:00
|
|
|
This is most useful with the `time.monotonic` function, introduced
|
2012-10-01 06:57:49 +00:00
|
|
|
in Python 3.3 and backported to older versions via the ``monotime``
|
|
|
|
module. Using a monotonic clock here avoids problems when the system
|
|
|
|
clock is changed.
|
2013-03-16 03:29:42 +00:00
|
|
|
* New function `.IOLoop.time` returns the current time according to the
|
2012-10-01 06:57:49 +00:00
|
|
|
IOLoop. To use the new monotonic clock functionality, all calls to
|
2013-03-16 03:29:42 +00:00
|
|
|
`.IOLoop.add_timeout` must be either pass a `datetime.timedelta` or
|
|
|
|
a time relative to `.IOLoop.time`, not `time.time`. (`time.time` will
|
2012-10-01 06:57:49 +00:00
|
|
|
continue to work only as long as the IOLoop's ``time_func`` argument
|
|
|
|
is not used).
|
2013-03-16 03:29:42 +00:00
|
|
|
* New convenience method `.IOLoop.run_sync` can be used to start an IOLoop
|
2013-03-04 03:47:30 +00:00
|
|
|
just long enough to run a single coroutine.
|
2013-03-16 03:29:42 +00:00
|
|
|
* New method `.IOLoop.add_callback_from_signal` is safe to use in a signal
|
|
|
|
handler (the regular `.add_callback` method may deadlock).
|
|
|
|
* `.IOLoop` now uses `signal.set_wakeup_fd` where available (Python 2.6+
|
2013-03-04 03:47:30 +00:00
|
|
|
on Unix) to avoid a race condition that could result in Python signal
|
|
|
|
handlers being delayed.
|
2013-03-16 03:29:42 +00:00
|
|
|
* Method ``IOLoop.running()`` has been removed.
|
|
|
|
* `.IOLoop` has been refactored to better support subclassing.
|
|
|
|
* `.IOLoop.add_callback` and `.add_callback_from_signal` now take
|
2013-01-26 18:33:52 +00:00
|
|
|
``*args, **kwargs`` to pass along to the callback.
|
|
|
|
|
|
|
|
`tornado.iostream`
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.IOStream.connect` now has an optional ``server_hostname`` argument
|
2013-03-04 03:47:30 +00:00
|
|
|
which will be used for SSL certificate validation when applicable.
|
|
|
|
Additionally, when supported (on Python 3.2+), this hostname
|
2013-03-16 03:29:42 +00:00
|
|
|
will be sent via SNI (and this is supported by ``tornado.simple_httpclient``)
|
|
|
|
* Much of `.IOStream` has been refactored into a separate class
|
|
|
|
`.BaseIOStream`.
|
2013-03-04 03:47:30 +00:00
|
|
|
* New class `tornado.iostream.PipeIOStream` provides the IOStream
|
|
|
|
interface on pipe file descriptors.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.IOStream` now raises a new exception
|
|
|
|
``tornado.iostream.StreamClosedError`` when you attempt to read or
|
2012-10-04 05:36:46 +00:00
|
|
|
write after the stream has been closed (by either side).
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.IOStream` now simply closes the connection when it gets an
|
2012-10-04 05:36:46 +00:00
|
|
|
``ECONNRESET`` error, rather than logging it as an error.
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``IOStream.error`` no longer picks up unrelated exceptions.
|
|
|
|
* `.BaseIOStream.close` now has an ``exc_info`` argument (similar to the
|
2013-01-26 18:33:52 +00:00
|
|
|
one used in the `logging` module) that can be used to set the stream's
|
|
|
|
``error`` attribute when closing it.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.BaseIOStream.read_until_close` now works correctly when it is called
|
2013-03-03 00:29:04 +00:00
|
|
|
while there is buffered data.
|
2013-03-04 03:47:30 +00:00
|
|
|
* Fixed a major performance regression when run on PyPy (introduced in
|
|
|
|
Tornado 2.3).
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-02-27 03:53:46 +00:00
|
|
|
`tornado.log`
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* New module containing `.enable_pretty_logging` and `.LogFormatter`,
|
2013-02-27 03:53:46 +00:00
|
|
|
moved from the options module.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.LogFormatter` now handles non-ascii data in messages and tracebacks better.
|
2013-02-27 03:53:46 +00:00
|
|
|
|
2013-01-26 18:33:52 +00:00
|
|
|
`tornado.netutil`
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-04 03:47:30 +00:00
|
|
|
* New class `tornado.netutil.Resolver` provides an asynchronous
|
|
|
|
interface to DNS resolution. The default implementation is still
|
|
|
|
blocking, but non-blocking implementations are available using one
|
|
|
|
of three optional dependencies: `~tornado.netutil.ThreadedResolver`
|
|
|
|
using the `concurrent.futures` thread pool,
|
2013-03-16 22:52:07 +00:00
|
|
|
`tornado.platform.caresresolver.CaresResolver` using the ``pycares``
|
|
|
|
library, or `tornado.platform.twisted.TwistedResolver` using ``twisted``
|
2013-03-04 03:47:30 +00:00
|
|
|
* New function `tornado.netutil.is_valid_ip` returns true if a given string
|
|
|
|
is a valid IP (v4 or v6) address.
|
2013-01-26 18:33:52 +00:00
|
|
|
* `tornado.netutil.bind_sockets` has a new ``flags`` argument that can
|
|
|
|
be used to pass additional flags to ``getaddrinfo``.
|
2013-03-04 03:47:30 +00:00
|
|
|
* `tornado.netutil.bind_sockets` no longer sets ``AI_ADDRCONFIG``; this will
|
|
|
|
cause it to bind to both ipv4 and ipv6 more often than before.
|
2013-01-26 18:33:52 +00:00
|
|
|
* `tornado.netutil.bind_sockets` now works when Python was compiled
|
|
|
|
with ``--disable-ipv6`` but IPv6 DNS resolution is available on the
|
|
|
|
system.
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``tornado.netutil.TCPServer`` has moved to its own module, `tornado.tcpserver`.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.options`
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-04 03:47:30 +00:00
|
|
|
* The class underlying the functions in `tornado.options` is now public
|
|
|
|
(`tornado.options.OptionParser`). This can be used to create multiple
|
|
|
|
independent option sets, such as for subcommands.
|
2013-01-26 18:33:52 +00:00
|
|
|
* `tornado.options.parse_config_file` now configures logging automatically
|
2013-03-16 03:29:42 +00:00
|
|
|
by default, in the same way that `~tornado.options.parse_command_line` does.
|
2013-01-26 18:33:52 +00:00
|
|
|
* New function `tornado.options.add_parse_callback` schedules a callback
|
|
|
|
to be run after the command line or config file has been parsed. The
|
|
|
|
keyword argument ``final=False`` can be used on either parsing function
|
|
|
|
to supress these callbacks.
|
|
|
|
* `tornado.options.define` now takes a ``callback`` argument. This callback
|
|
|
|
will be run with the new value whenever the option is changed. This is
|
|
|
|
especially useful for options that set other options, such as by reading
|
|
|
|
from a config file.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `tornado.options.parse_command_line` ``--help`` output now goes to ``stderr``
|
2013-01-26 18:33:52 +00:00
|
|
|
rather than ``stdout``.
|
|
|
|
* `tornado.options.options` is no longer a subclass of `dict`; attribute-style
|
|
|
|
access is now required.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `tornado.options.options` (and `.OptionParser` instances generally) now
|
|
|
|
have a `.mockable()` method that returns a wrapper object compatible with
|
|
|
|
`mock.patch <unittest.mock.patch>`.
|
|
|
|
* Function ``tornado.options.enable_pretty_logging`` has been moved to the
|
2013-03-04 03:47:30 +00:00
|
|
|
`tornado.log` module.
|
|
|
|
|
2013-03-16 22:52:07 +00:00
|
|
|
`tornado.platform.caresresolver`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-03-04 03:47:30 +00:00
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* New module containing an asynchronous implementation of the `.Resolver`
|
|
|
|
interface, using the ``pycares`` library.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.platform.twisted`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 22:52:07 +00:00
|
|
|
* New class `tornado.platform.twisted.TwistedIOLoop` allows Tornado
|
2012-10-07 21:21:42 +00:00
|
|
|
code to be run on the Twisted reactor (as opposed to the existing
|
2013-03-16 22:52:07 +00:00
|
|
|
`.TornadoReactor`, which bridges the gap in the other direction).
|
|
|
|
* New class `tornado.platform.twisted.TwistedResolver` is an asynchronous
|
2013-03-16 03:29:42 +00:00
|
|
|
implementation of the `.Resolver` interface.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.process`
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* New class `tornado.process.Subprocess` wraps `subprocess.Popen` with
|
2013-03-16 03:29:42 +00:00
|
|
|
`.PipeIOStream` access to the child's file descriptors.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
``tornado.simple_httpclient``
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-16 22:52:07 +00:00
|
|
|
* ``SimpleAsyncHTTPClient`` now takes a ``resolver`` keyword argument
|
|
|
|
(which may be passed to either the constructor or `configure
|
|
|
|
<.Configurable.configure>`), to allow it to use the new non-blocking
|
|
|
|
`tornado.netutil.Resolver`.
|
2013-03-16 03:29:42 +00:00
|
|
|
* When following redirects, ``SimpleAsyncHTTPClient`` now treats a 302
|
2012-11-01 17:23:27 +00:00
|
|
|
response code the same as a 303. This is contrary to the HTTP spec
|
|
|
|
but consistent with all browsers and other major HTTP clients
|
2013-03-16 03:29:42 +00:00
|
|
|
(including ``CurlAsyncHTTPClient``).
|
|
|
|
* The behavior of ``header_callback`` with ``SimpleAsyncHTTPClient`` has
|
|
|
|
changed and is now the same as that of ``CurlAsyncHTTPClient``. The
|
2012-11-18 17:25:13 +00:00
|
|
|
header callback now receives the first line of the response (e.g.
|
|
|
|
``HTTP/1.0 200 OK``) and the final empty line.
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``tornado.simple_httpclient`` now accepts responses with a 304
|
|
|
|
status code that include a ``Content-Length`` header.
|
|
|
|
* Fixed a bug in which ``SimpleAsyncHTTPClient`` callbacks were being run in the
|
2013-01-26 18:33:52 +00:00
|
|
|
client's ``stack_context``.
|
|
|
|
|
|
|
|
`tornado.stack_context`
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.stack_context.wrap` now runs the wrapped callback in a more consistent
|
2013-01-26 18:33:52 +00:00
|
|
|
environment by recreating contexts even if they already exist on the
|
|
|
|
stack.
|
|
|
|
* Fixed a bug in which stack contexts could leak from one callback
|
|
|
|
chain to another.
|
2013-02-27 03:53:46 +00:00
|
|
|
* Yield statements inside a ``with`` statement can cause stack
|
|
|
|
contexts to become inconsistent; an exception will now be raised
|
|
|
|
when this case is detected.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.template`
|
|
|
|
~~~~~~~~~~~~~~~~~~
|
|
|
|
|
|
|
|
* Errors while rendering templates no longer log the generated code,
|
|
|
|
since the enhanced stack traces (from version 2.1) should make this
|
|
|
|
unnecessary.
|
|
|
|
* The ``{% apply %}`` directive now works properly with functions that return
|
|
|
|
both unicode strings and byte strings (previously only byte strings were
|
|
|
|
supported).
|
2013-02-27 03:53:46 +00:00
|
|
|
* Code in templates is no longer affected by Tornado's ``__future__`` imports
|
|
|
|
(which previously included ``absolute_import`` and ``division``).
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
`tornado.testing`
|
|
|
|
~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-03-04 03:47:30 +00:00
|
|
|
* New function `tornado.testing.bind_unused_port` both chooses a port
|
|
|
|
and binds a socket to it, so there is no risk of another process
|
|
|
|
using the same port. ``get_unused_port`` is now deprecated.
|
|
|
|
* New decorator `tornado.testing.gen_test` can be used to allow for
|
|
|
|
yielding `tornado.gen` objects in tests, as an alternative to the
|
2013-03-16 03:29:42 +00:00
|
|
|
``stop`` and ``wait`` methods of `.AsyncTestCase`.
|
2013-01-26 18:33:52 +00:00
|
|
|
* `tornado.testing.AsyncTestCase` and friends now extend ``unittest2.TestCase``
|
|
|
|
when it is available (and continue to use the standard ``unittest`` module
|
|
|
|
when ``unittest2`` is not available)
|
|
|
|
* `tornado.testing.ExpectLog` can be used as a finer-grained alternative
|
|
|
|
to `tornado.testing.LogTrapTestCase`
|
|
|
|
* The command-line interface to `tornado.testing.main` now supports
|
|
|
|
additional arguments from the underlying `unittest` module:
|
|
|
|
``verbose``, ``quiet``, ``failfast``, ``catch``, ``buffer``.
|
|
|
|
* The deprecated ``--autoreload`` option of `tornado.testing.main` has
|
|
|
|
been removed. Use ``python -m tornado.autoreload`` as a prefix command
|
|
|
|
instead.
|
|
|
|
* The ``--httpclient`` option of `tornado.testing.main` has been moved
|
2013-03-16 03:29:42 +00:00
|
|
|
to ``tornado.test.runtests`` so as not to pollute the application
|
2013-01-26 18:33:52 +00:00
|
|
|
option namespace. The `tornado.options` module's new callback
|
|
|
|
support now makes it easy to add options from a wrapper script
|
|
|
|
instead of putting all possible options in `tornado.testing.main`.
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.AsyncHTTPTestCase` no longer calls `.AsyncHTTPClient.close` for tests
|
|
|
|
that use the singleton `.IOLoop.instance`.
|
|
|
|
* `.LogTrapTestCase` no longer fails when run in unknown logging
|
2013-02-27 03:53:46 +00:00
|
|
|
configurations. This allows tests to be run under nose, which does its
|
2013-03-16 03:29:42 +00:00
|
|
|
own log buffering (`.LogTrapTestCase` doesn't do anything useful in this
|
2013-02-27 03:53:46 +00:00
|
|
|
case, but at least it doesn't break things any more).
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
``tornado.util``
|
|
|
|
~~~~~~~~~~~~~~~~
|
2013-01-26 18:33:52 +00:00
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``tornado.util.b`` (which was only intended for internal use) is gone.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.web`
|
|
|
|
~~~~~~~~~~~~~
|
|
|
|
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.RequestHandler.set_header` now overwrites previous header values
|
2013-03-04 03:47:30 +00:00
|
|
|
case-insensitively.
|
|
|
|
* `tornado.web.RequestHandler` has new attributes ``path_args`` and
|
|
|
|
``path_kwargs``, which contain the positional and keyword arguments
|
|
|
|
that are passed to the ``get``/``post``/etc method. These attributes
|
|
|
|
are set before those methods are called, so they are available during
|
|
|
|
``prepare()``
|
|
|
|
* `tornado.web.ErrorHandler` no longer requires XSRF tokens on ``POST``
|
|
|
|
requests, so posts to an unknown url will always return 404 instead of
|
|
|
|
complaining about XSRF tokens.
|
2013-01-26 18:33:52 +00:00
|
|
|
* Several methods related to HTTP status codes now take a ``reason`` keyword
|
|
|
|
argument to specify an alternate "reason" string (i.e. the "Not Found" in
|
|
|
|
"HTTP/1.1 404 Not Found"). It is now possible to set status codes other
|
|
|
|
than those defined in the spec, as long as a reason string is given.
|
2013-03-04 03:47:30 +00:00
|
|
|
* The ``Date`` HTTP header is now set by default on all responses.
|
2013-03-16 03:29:42 +00:00
|
|
|
* ``Etag``/``If-None-Match`` requests now work with `.StaticFileHandler`.
|
|
|
|
* `.StaticFileHandler` no longer sets ``Cache-Control: public`` unnecessarily.
|
2012-12-08 23:27:12 +00:00
|
|
|
* When gzip is enabled in a `tornado.web.Application`, appropriate
|
|
|
|
``Vary: Accept-Encoding`` headers are now sent.
|
2012-12-21 04:51:17 +00:00
|
|
|
* It is no longer necessary to pass all handlers for a host in a single
|
2013-03-16 03:29:42 +00:00
|
|
|
`.Application.add_handlers` call. Now the request will be matched
|
2012-12-21 04:51:17 +00:00
|
|
|
against the handlers for any ``host_pattern`` that includes the request's
|
|
|
|
``Host`` header.
|
2013-01-26 18:33:52 +00:00
|
|
|
|
|
|
|
`tornado.websocket`
|
|
|
|
~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
2013-02-27 03:53:46 +00:00
|
|
|
* Client-side WebSocket support is now available:
|
2013-03-15 03:45:48 +00:00
|
|
|
`tornado.websocket.websocket_connect`
|
2013-03-16 03:29:42 +00:00
|
|
|
* `.WebSocketHandler` has new methods `~.WebSocketHandler.ping` and
|
|
|
|
`~.WebSocketHandler.on_pong` to send pings to the browser (not
|
|
|
|
supported on the ``draft76`` protocol)
|