BaseRequest.route()
property returns the Route
that originally matched the request.BaseRequest.MAX_PARAMS
limit. The hash collision bug in CPythons dict() implementation was fixed over a year ago. If you are still using Python 2.5 in production, consider upgrading or at least make sure that you get security fixed from your distributor.ConfigDict
API (see Configuration (DRAFT))More information can be found in this development blog post.
Range
header) in static_file()
.ResourceManager
interface helps locating files bundled with an application.Bottle.merge()
method to install all routes from one application into another.BaseRequest.app
property to get the application object that handles a request.FormsDict.decode()
to get an all-unicode version (needed by WTForms).MultiDict
and subclasses are now pickle-able.API Changes
Response.status
is a read-write property that can be assigned either a numeric status code or a status string with a reason phrase (200 OK
). The return value is now a string to better match existing APIs (WebOb, werkzeug). To be absolutely clear, you can use the read-only properties BaseResponse.status_code
and BaseResponse.status_line
.API Deprecations
SimpleTALTemplate
is now deprecating. There seems to be no demand.Plugin.api
to 2
.Plugin.apply()
receives a Route
object instead of a context dictionary as second parameter. The new object offers some additional information and may be extended in the future.BaseRequest.json
, BaseRequest.remote_route
, BaseRequest.remote_addr
, BaseRequest.query
and BaseRequest.script_name
.BaseResponse.status_line
and BaseResponse.status_code
attributes. In future releases, BaseResponse.status
will return a string (e.g. 200 OK
) instead of an integer to match the API of other common frameworks. To make the transition as smooth as possible, you should use the verbose attributes from now on.MultiDict
with a specialized FormsDict
in many places. The new dict implementation allows attribute access and handles unicode form values transparently.stpl.defined()
, stpl.get()
and stpl.setdefault()
./object/<id:int>
) and support for route wildcard filters.ConfigDict
that makes accessing configuration a lot easier (attribute access and auto-expanding namespaces).Bottle.mount()
.Bottle.mount()
parameter order changed.Bottle.route()
now accpets an import string for the callback
parameter.Whats new?
route()
decorator got a lot of new features. See Bottle.route()
for details.Request.urlparts
property.Performance improvements
Router
now special-cases wsgi.run_once
environments to speed up CGI.API changes
This release is mostly backward compatible, but some APIs are marked deprecated now and will be removed for the next release. Most noteworthy:
static
route parameter is deprecated. You can escape wild-cards with a backslash.API changes
These changes may break compatibility with previous versions.
#
. In 0.6 all non-alphanumeric characters not present in the regular expression were allowed./index:#(\.html)?#
) to achieve a similar behaviour.BreakTheBottle
exception is gone. Use HTTPResponse
instead.SimpleTemplate
engine escapes HTML special characters in {{bad_html}}
expressions automatically. Use the new {{!good_html}}
syntax to get old behaviour (no escaping).SimpleTemplate
engine returns unicode strings instead of lists of byte strings.bottle.optimize()
and the automatic route optimization is obsolete.Request._environ
is now Request.environ
Response.header
is now Response.headers
default_app()
is obsolete. Use app()
instead.redirect()
code changed from 307 to 303.@default
. Use @error(404)
instead.New features
This is an incomplete list of new features and improved functionality.
Request
object got new properties: Request.body
, Request.auth
, Request.url
, Request.header
, Request.forms
, Request.files
.Response.set_cookie()
and Request.get_cookie()
methods are now able to encode and decode python objects. This is called a secure cookie because the encoded values are signed and protected from changes on client side. All pickle-able data structures are allowed.Router
class drastically improves performance for setups with lots of dynamic routes and supports named routes (named route + dict = URL string).HTTPError
and HTTPResponse
instances or other exception objects instead of raising them.static_file()
equals send_file()
but returns a HTTPResponse
or HTTPError
instead of raising it. send_file()
is deprecated.get()
, post()
, put()
and delete()
decorators.SimpleTemplate
engine got full unicode support.