CHANGES
This file
Path
CHANGES
495 lines · 22.2 KiB
Last changed by
Merge branch '0.10-maintenance'Armin Ronacherbefore adoptiona8f6f74
History of this fileTake it
1Flask Changelog2===============34Here you can see the full list of changes between each Flask release.56Version 1.07-----------89(release date to be announced, codename to be selected)1011- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the12 set-cookie behavior. If set to `True` a permanent session will be13 refreshed each request and get their lifetime extended, if set to14 `False` it will only be modified if the session actually modifies.15 Non permanent sessions are not affected by this and will always16 expire if the browser window closes.17- Made Flask support custom JSON mimetypes for incoming data.18- Added support for returning tuples in the form ``(response, headers)``19 from a view function.2021Version 0.10.222--------------2324(bugfix release, release date to be announced)2526- Fixed broken `test_appcontext_signals()` test case.27- Raise an :exc:`AttributeError` in :func:`flask.helpers.find_package` with a28 useful message explaining why it is raised when a PEP 302 import hook is used29 without an `is_package()` method.30- Fixed an issue causing exceptions raised before entering a request or app31 context to be passed to teardown handlers.32- Fixed an issue with query parameters getting removed from requests in33 the test client when absolute URLs were requested.34- Made `@before_first_request` into a decorator as intended.3536Version 0.10.137--------------3839(bugfix release, released on June 14th 2013)4041- Fixed an issue where ``|tojson`` was not quoting single quotes which42 made the filter not work properly in HTML attributes. Now it's43 possible to use that filter in single quoted attributes. This should44 make using that filter with angular.js easier.45- Added support for byte strings back to the session system. This broke46 compatibility with the common case of people putting binary data for47 token verification into the session.48- Fixed an issue where registering the same method twice for the same endpoint49 would trigger an exception incorrectly.5051Version 0.1052------------5354Released on June 13nd 2013, codename Limoncello.5556- Changed default cookie serialization format from pickle to JSON to57 limit the impact an attacker can do if the secret key leaks. See58 :ref:`upgrading-to-010` for more information.59- Added ``template_test`` methods in addition to the already existing60 ``template_filter`` method family.61- Added ``template_global`` methods in addition to the already existing62 ``template_filter`` method family.63- Set the content-length header for x-sendfile.64- ``tojson`` filter now does not escape script blocks in HTML5 parsers.65- ``tojson`` used in templates is now safe by default due. This was66 allowed due to the different escaping behavior.67- Flask will now raise an error if you attempt to register a new function68 on an already used endpoint.69- Added wrapper module around simplejson and added default serialization70 of datetime objects. This allows much easier customization of how71 JSON is handled by Flask or any Flask extension.72- Removed deprecated internal ``flask.session`` module alias. Use73 ``flask.sessions`` instead to get the session module. This is not to74 be confused with ``flask.session`` the session proxy.75- Templates can now be rendered without request context. The behavior is76 slightly different as the ``request``, ``session`` and ``g`` objects77 will not be available and blueprint's context processors are not78 called.79- The config object is now available to the template as a real global and80 not through a context processor which makes it available even in imported81 templates by default.82- Added an option to generate non-ascii encoded JSON which should result83 in less bytes being transmitted over the network. It's disabled by84 default to not cause confusion with existing libraries that might expect85 ``flask.json.dumps`` to return bytestrings by default.86- ``flask.g`` is now stored on the app context instead of the request87 context.88- ``flask.g`` now gained a ``get()`` method for not erroring out on non89 existing items.90- ``flask.g`` now can be used with the ``in`` operator to see what's defined91 and it now is iterable and will yield all attributes stored.92- ``flask.Flask.request_globals_class`` got renamed to93 ``flask.Flask.app_ctx_globals_class`` which is a better name to what it94 does since 0.10.95- `request`, `session` and `g` are now also added as proxies to the template96 context which makes them available in imported templates. One has to be97 very careful with those though because usage outside of macros might98 cause caching.99- Flask will no longer invoke the wrong error handlers if a proxy100 exception is passed through.101- Added a workaround for chrome's cookies in localhost not working102 as intended with domain names.103- Changed logic for picking defaults for cookie values from sessions104 to work better with Google Chrome.105- Added `message_flashed` signal that simplifies flashing testing.106- Added support for copying of request contexts for better working with107 greenlets.108- Removed custom JSON HTTP exception subclasses. If you were relying on them109 you can reintroduce them again yourself trivially. Using them however is110 strongly discouraged as the interface was flawed.111- Python requirements changed: requiring Python 2.6 or 2.7 now to prepare112 for Python 3.3 port.113- Changed how the teardown system is informed about exceptions. This is now114 more reliable in case something handles an exception halfway through115 the error handling process.116- Request context preservation in debug mode now keeps the exception117 information around which means that teardown handlers are able to118 distinguish error from success cases.119- Added the ``JSONIFY_PRETTYPRINT_REGULAR`` configuration variable.120- Flask now orders JSON keys by default to not trash HTTP caches due to121 different hash seeds between different workers.122- Added `appcontext_pushed` and `appcontext_popped` signals.123- The builtin run method now takes the ``SERVER_NAME`` into account when124 picking the default port to run on.125- Added `flask.request.get_json()` as a replacement for the old126 `flask.request.json` property.127128Version 0.9129-----------130131Released on July 1st 2012, codename Campari.132133- The :func:`flask.Request.on_json_loading_failed` now returns a JSON formatted134 response by default.135- The :func:`flask.url_for` function now can generate anchors to the136 generated links.137- The :func:`flask.url_for` function now can also explicitly generate138 URL rules specific to a given HTTP method.139- Logger now only returns the debug log setting if it was not set140 explicitly.141- Unregister a circular dependency between the WSGI environment and142 the request object when shutting down the request. This means that143 environ ``werkzeug.request`` will be `None` after the response was144 returned to the WSGI server but has the advantage that the garbage145 collector is not needed on CPython to tear down the request unless146 the user created circular dependencies themselves.147- Session is now stored after callbacks so that if the session payload148 is stored in the session you can still modify it in an after149 request callback.150- The :class:`flask.Flask` class will avoid importing the provided import name151 if it can (the required first parameter), to benefit tools which build Flask152 instances programmatically. The Flask class will fall back to using import153 on systems with custom module hooks, e.g. Google App Engine, or when the154 import name is inside a zip archive (usually a .egg) prior to Python 2.7.155- Blueprints now have a decorator to add custom template filters application156 wide, :meth:`flask.Blueprint.app_template_filter`.157- The Flask and Blueprint classes now have a non-decorator method for adding158 custom template filters application wide,159 :meth:`flask.Flask.add_template_filter` and160 :meth:`flask.Blueprint.add_app_template_filter`.161- The :func:`flask.get_flashed_messages` function now allows rendering flashed162 message categories in separate blocks, through a ``category_filter``163 argument.164- The :meth:`flask.Flask.run` method now accepts `None` for `host` and `port`165 arguments, using default values when `None`. This allows for calling run166 using configuration values, e.g. ``app.run(app.config.get('MYHOST'),167 app.config.get('MYPORT'))``, with proper behavior whether or not a config168 file is provided.169- The :meth:`flask.render_template` method now accepts a either an iterable of170 template names or a single template name. Previously, it only accepted a171 single template name. On an iterable, the first template found is rendered.172- Added :meth:`flask.Flask.app_context` which works very similar to the173 request context but only provides access to the current application. This174 also adds support for URL generation without an active request context.175- View functions can now return a tuple with the first instance being an176 instance of :class:`flask.Response`. This allows for returning177 ``jsonify(error="error msg"), 400`` from a view function.178- :class:`~flask.Flask` and :class:`~flask.Blueprint` now provide a179 :meth:`~flask.Flask.get_send_file_max_age` hook for subclasses to override180 behavior of serving static files from Flask when using181 :meth:`flask.Flask.send_static_file` (used for the default static file182 handler) and :func:`~flask.helpers.send_file`. This hook is provided a183 filename, which for example allows changing cache controls by file extension.184 The default max-age for `send_file` and static files can be configured185 through a new ``SEND_FILE_MAX_AGE_DEFAULT`` configuration variable, which is186 used in the default `get_send_file_max_age` implementation.187- Fixed an assumption in sessions implementation which could break message188 flashing on sessions implementations which use external storage.189- Changed the behavior of tuple return values from functions. They are no190 longer arguments to the response object, they now have a defined meaning.191- Added :attr:`flask.Flask.request_globals_class` to allow a specific class to192 be used on creation of the :data:`~flask.g` instance of each request.193- Added `required_methods` attribute to view functions to force-add methods194 on registration.195- Added :func:`flask.after_this_request`.196- Added :func:`flask.stream_with_context` and the ability to push contexts197 multiple times without producing unexpected behavior.198199Version 0.8.1200-------------201202Bugfix release, released on July 1st 2012203204- Fixed an issue with the undocumented `flask.session` module to not205 work properly on Python 2.5. It should not be used but did cause206 some problems for package managers.207208Version 0.8209-----------210211Released on September 29th 2011, codename Rakija212213- Refactored session support into a session interface so that214 the implementation of the sessions can be changed without215 having to override the Flask class.216- Empty session cookies are now deleted properly automatically.217- View functions can now opt out of getting the automatic218 OPTIONS implementation.219- HTTP exceptions and Bad Request errors can now be trapped so that they220 show up normally in the traceback.221- Flask in debug mode is now detecting some common problems and tries to222 warn you about them.223- Flask in debug mode will now complain with an assertion error if a view224 was attached after the first request was handled. This gives earlier225 feedback when users forget to import view code ahead of time.226- Added the ability to register callbacks that are only triggered once at227 the beginning of the first request. (:meth:`Flask.before_first_request`)228- Malformed JSON data will now trigger a bad request HTTP exception instead229 of a value error which usually would result in a 500 internal server230 error if not handled. This is a backwards incompatible change.231- Applications now not only have a root path where the resources and modules232 are located but also an instance path which is the designated place to233 drop files that are modified at runtime (uploads etc.). Also this is234 conceptionally only instance depending and outside version control so it's235 the perfect place to put configuration files etc. For more information236 see :ref:`instance-folders`.237- Added the ``APPLICATION_ROOT`` configuration variable.238- Implemented :meth:`~flask.testing.TestClient.session_transaction` to239 easily modify sessions from the test environment.240- Refactored test client internally. The ``APPLICATION_ROOT`` configuration241 variable as well as ``SERVER_NAME`` are now properly used by the test client242 as defaults.243- Added :attr:`flask.views.View.decorators` to support simpler decorating of244 pluggable (class-based) views.245- Fixed an issue where the test client if used with the "with" statement did not246 trigger the execution of the teardown handlers.247- Added finer control over the session cookie parameters.248- HEAD requests to a method view now automatically dispatch to the `get`249 method if no handler was implemented.250- Implemented the virtual :mod:`flask.ext` package to import extensions from.251- The context preservation on exceptions is now an integral component of252 Flask itself and no longer of the test client. This cleaned up some253 internal logic and lowers the odds of runaway request contexts in unittests.254255Version 0.7.3256-------------257258Bugfix release, release date to be decided259260- Fixed the Jinja2 environment's list_templates method not returning the261 correct names when blueprints or modules were involved.262263Version 0.7.2264-------------265266Bugfix release, released on July 6th 2011267268- Fixed an issue with URL processors not properly working on269 blueprints.270271Version 0.7.1272-------------273274Bugfix release, released on June 29th 2011275276- Added missing future import that broke 2.5 compatibility.277- Fixed an infinite redirect issue with blueprints.278279Version 0.7280-----------281282Released on June 28th 2011, codename Grappa283284- Added :meth:`~flask.Flask.make_default_options_response`285 which can be used by subclasses to alter the default286 behavior for `OPTIONS` responses.287- Unbound locals now raise a proper :exc:`RuntimeError` instead288 of an :exc:`AttributeError`.289- Mimetype guessing and etag support based on file objects is now290 deprecated for :func:`flask.send_file` because it was unreliable.291 Pass filenames instead or attach your own etags and provide a292 proper mimetype by hand.293- Static file handling for modules now requires the name of the294 static folder to be supplied explicitly. The previous autodetection295 was not reliable and caused issues on Google's App Engine. Until296 1.0 the old behavior will continue to work but issue dependency297 warnings.298- fixed a problem for Flask to run on jython.299- added a `PROPAGATE_EXCEPTIONS` configuration variable that can be300 used to flip the setting of exception propagation which previously301 was linked to `DEBUG` alone and is now linked to either `DEBUG` or302 `TESTING`.303- Flask no longer internally depends on rules being added through the304 `add_url_rule` function and can now also accept regular werkzeug305 rules added to the url map.306- Added an `endpoint` method to the flask application object which307 allows one to register a callback to an arbitrary endpoint with308 a decorator.309- Use Last-Modified for static file sending instead of Date which310 was incorrectly introduced in 0.6.311- Added `create_jinja_loader` to override the loader creation process.312- Implemented a silent flag for `config.from_pyfile`.313- Added `teardown_request` decorator, for functions that should run at the end314 of a request regardless of whether an exception occurred. Also the behavior315 for `after_request` was changed. It's now no longer executed when an exception316 is raised. See :ref:`upgrading-to-new-teardown-handling`317- Implemented :func:`flask.has_request_context`318- Deprecated `init_jinja_globals`. Override the319 :meth:`~flask.Flask.create_jinja_environment` method instead to320 achieve the same functionality.321- Added :func:`flask.safe_join`322- The automatic JSON request data unpacking now looks at the charset323 mimetype parameter.324- Don't modify the session on :func:`flask.get_flashed_messages` if there325 are no messages in the session.326- `before_request` handlers are now able to abort requests with errors.327- it is not possible to define user exception handlers. That way you can328 provide custom error messages from a central hub for certain errors that329 might occur during request processing (for instance database connection330 errors, timeouts from remote resources etc.).331- Blueprints can provide blueprint specific error handlers.332- Implemented generic :ref:`views` (class-based views).333334Version 0.6.1335-------------336337Bugfix release, released on December 31st 2010338339- Fixed an issue where the default `OPTIONS` response was340 not exposing all valid methods in the `Allow` header.341- Jinja2 template loading syntax now allows "./" in front of342 a template load path. Previously this caused issues with343 module setups.344- Fixed an issue where the subdomain setting for modules was345 ignored for the static folder.346- Fixed a security problem that allowed clients to download arbitrary files347 if the host server was a windows based operating system and the client348 uses backslashes to escape the directory the files where exposed from.349350Version 0.6351-----------352353Released on July 27th 2010, codename Whisky354355- after request functions are now called in reverse order of356 registration.357- OPTIONS is now automatically implemented by Flask unless the358 application explicitly adds 'OPTIONS' as method to the URL rule.359 In this case no automatic OPTIONS handling kicks in.360- static rules are now even in place if there is no static folder361 for the module. This was implemented to aid GAE which will362 remove the static folder if it's part of a mapping in the .yml363 file.364- the :attr:`~flask.Flask.config` is now available in the templates365 as `config`.366- context processors will no longer override values passed directly367 to the render function.368- added the ability to limit the incoming request data with the369 new ``MAX_CONTENT_LENGTH`` configuration value.370- the endpoint for the :meth:`flask.Module.add_url_rule` method371 is now optional to be consistent with the function of the372 same name on the application object.373- added a :func:`flask.make_response` function that simplifies374 creating response object instances in views.375- added signalling support based on blinker. This feature is currently376 optional and supposed to be used by extensions and applications. If377 you want to use it, make sure to have `blinker`_ installed.378- refactored the way URL adapters are created. This process is now379 fully customizable with the :meth:`~flask.Flask.create_url_adapter`380 method.381- modules can now register for a subdomain instead of just an URL382 prefix. This makes it possible to bind a whole module to a383 configurable subdomain.384385.. _blinker: http://pypi.python.org/pypi/blinker386387Version 0.5.2388-------------389390Bugfix Release, released on July 15th 2010391392- fixed another issue with loading templates from directories when393 modules were used.394395Version 0.5.1396-------------397398Bugfix Release, released on July 6th 2010399400- fixes an issue with template loading from directories when modules401 where used.402403Version 0.5404-----------405406Released on July 6th 2010, codename Calvados407408- fixed a bug with subdomains that was caused by the inability to409 specify the server name. The server name can now be set with410 the `SERVER_NAME` config key. This key is now also used to set411 the session cookie cross-subdomain wide.412- autoescaping is no longer active for all templates. Instead it413 is only active for ``.html``, ``.htm``, ``.xml`` and ``.xhtml``.414 Inside templates this behavior can be changed with the415 ``autoescape`` tag.416- refactored Flask internally. It now consists of more than a417 single file.418- :func:`flask.send_file` now emits etags and has the ability to419 do conditional responses builtin.420- (temporarily) dropped support for zipped applications. This was a421 rarely used feature and led to some confusing behavior.422- added support for per-package template and static-file directories.423- removed support for `create_jinja_loader` which is no longer used424 in 0.5 due to the improved module support.425- added a helper function to expose files from any directory.426427Version 0.4428-----------429430Released on June 18th 2010, codename Rakia431432- added the ability to register application wide error handlers433 from modules.434- :meth:`~flask.Flask.after_request` handlers are now also invoked435 if the request dies with an exception and an error handling page436 kicks in.437- test client has not the ability to preserve the request context438 for a little longer. This can also be used to trigger custom439 requests that do not pop the request stack for testing.440- because the Python standard library caches loggers, the name of441 the logger is configurable now to better support unittests.442- added `TESTING` switch that can activate unittesting helpers.443- the logger switches to `DEBUG` mode now if debug is enabled.444445Version 0.3.1446-------------447448Bugfix release, released on May 28th 2010449450- fixed a error reporting bug with :meth:`flask.Config.from_envvar`451- removed some unused code from flask452- release does no longer include development leftover files (.git453 folder for themes, built documentation in zip and pdf file and454 some .pyc files)455456Version 0.3457-----------458459Released on May 28th 2010, codename Schnaps460461- added support for categories for flashed messages.462- the application now configures a :class:`logging.Handler` and will463 log request handling exceptions to that logger when not in debug464 mode. This makes it possible to receive mails on server errors465 for example.466- added support for context binding that does not require the use of467 the with statement for playing in the console.468- the request context is now available within the with statement making469 it possible to further push the request context or pop it.470- added support for configurations.471472Version 0.2473-----------474475Released on May 12th 2010, codename Jägermeister476477- various bugfixes478- integrated JSON support479- added :func:`~flask.get_template_attribute` helper function.480- :meth:`~flask.Flask.add_url_rule` can now also register a481 view function.482- refactored internal request dispatching.483- server listens on 127.0.0.1 by default now to fix issues with chrome.484- added external URL support.485- added support for :func:`~flask.send_file`486- module support and internal request handling refactoring487 to better support pluggable applications.488- sessions can be set to be permanent now on a per-session basis.489- better error reporting on missing secret keys.490- added support for Google Appengine.491492Version 0.1493-----------494495First public preview release.