Flask 0.11 发布了,求英文好的解说下主要新特性

2016-05-30 09:25:07 +08:00
 qq7171891
Version 0.11
------------

Released on May 29th 2016, codename Absinthe.

- Added support to serializing top-level arrays to :func:`flask.jsonify`. This
introduces a security risk in ancient browsers. See
:ref:`json-security` for details.
- Added before_render_template signal.
- Added `**kwargs` to :meth:`flask.Test.test_client` to support passing
additional keyword arguments to the constructor of
:attr:`flask.Flask.test_client_class`.
- Added ``SESSION_REFRESH_EACH_REQUEST`` config key that controls the
set-cookie behavior. If set to ``True`` a permanent session will be
refreshed each request and get their lifetime extended, if set to
``False`` it will only be modified if the session actually modifies.
Non permanent sessions are not affected by this and will always
expire if the browser window closes.
- Made Flask support custom JSON mimetypes for incoming data.
- Added support for returning tuples in the form ``(response, headers)``
from a view function.
- Added :meth:`flask.Config.from_json`.
- Added :attr:`flask.Flask.config_class`.
- Added :meth:`flask.config.Config.get_namespace`.
- Templates are no longer automatically reloaded outside of debug mode. This
can be configured with the new ``TEMPLATES_AUTO_RELOAD`` config key.
- Added a workaround for a limitation in Python 3.3's namespace loader.
- Added support for explicit root paths when using Python 3.3's namespace
packages.
- Added :command:`flask` and the ``flask.cli`` module to start the local
debug server through the click CLI system. This is recommended over the old
``flask.run()`` method as it works faster and more reliable due to a
different design and also replaces ``Flask-Script``.
- Error handlers that match specific classes are now checked first,
thereby allowing catching exceptions that are subclasses of HTTP
exceptions (in ``werkzeug.exceptions``). This makes it possible
for an extension author to create exceptions that will by default
result in the HTTP error of their choosing, but may be caught with
a custom error handler if desired.
- Added :meth:`flask.Config.from_mapping`.
- Flask will now log by default even if debug is disabled. The log format is
now hardcoded but the default log handling can be disabled through the
``LOGGER_HANDLER_POLICY`` configuration key.
- Removed deprecated module functionality.
- Added the ``EXPLAIN_TEMPLATE_LOADING`` config flag which when enabled will
instruct Flask to explain how it locates templates. This should help
users debug when the wrong templates are loaded.
- Enforce blueprint handling in the order they were registered for template
loading.
- Ported test suite to py.test.
- Deprecated ``request.json`` in favour of ``request.get_json()``.
- Add "pretty" and "compressed" separators definitions in jsonify() method.
Reduces JSON response size when JSONIFY_PRETTYPRINT_REGULAR=False by removing
unnecessary white space included by default after separators.
- JSON responses are now terminated with a newline character, because it is a
convention that UNIX text files end with a newline and some clients don't
deal well when this newline is missing. See
https://github.com/pallets/flask/pull/1262 -- this came up originally as a
part of https://github.com/kennethreitz/httpbin/issues/168
- The automatically provided ``OPTIONS`` method is now correctly disabled if
the user registered an overriding rule with the lowercase-version
``options`` (issue ``#1288``).
- ``flask.json.jsonify`` now supports the ``datetime.date`` type (pull request
``#1326``).
- Don't leak exception info of already catched exceptions to context teardown
handlers (pull request ``#1393``).
- Allow custom Jinja environment subclasses (pull request ``#1422``).
- ``flask.g`` now has ``pop()`` and ``setdefault`` methods.
- Turn on autoescape for ``flask.templating.render_template_string`` by default
(pull request ``#1515``).
- ``flask.ext`` is now deprecated (pull request ``#1484``).
- ``send_from_directory`` now raises BadRequest if the filename is invalid on
the server OS (pull request ``#1763``).
- Added the ``JSONIFY_MIMETYPE`` configuration variable (pull request ``#1728``).
- Exceptions during teardown handling will no longer leave bad application
contexts lingering around.
5253 次点击
所在节点    Flask
21 条回复
jixiangqd
2016-05-30 09:28:18 +08:00
英语不好怎么干程序员的。。。?还追新特性,你知道了新特性能用的上吗?要用不还得看文档。。。
janxin
2016-05-30 09:37:21 +08:00
我还以为新版本是 1.0 ,看来还是没准备好
qq7171891
2016-05-30 09:48:26 +08:00
@jixiangqd
我不是程序员。
不知道能不能用上,就是好奇。
是得看,目前看不懂。

你好牛逼,大哥,牛逼哄哄。
xuwenmang
2016-05-30 09:51:24 +08:00
为啥不用 thinkphp
chengzhoukun
2016-05-30 09:54:56 +08:00
@xuwenmang 太黑了
Ixizi
2016-05-30 09:55:38 +08:00
不要惧怕长篇阅读,事实上里面词汇都很简单。
crazyxin1988
2016-05-30 09:58:39 +08:00
看来 1.0 还要等几年啊
mringg
2016-05-30 10:09:16 +08:00
看了看,对我来说,更新的都是极少用的(比较菜,用不上太高大上的)
不喜勿喷
lozio
2016-05-30 10:52:45 +08:00
为啥不用 thinkphp 哈哈哈哈哈哈哈哈
Zzzzzzzzz
2016-05-30 10:58:06 +08:00
都不是什么新特性, 大多都是三年前就进 dev 的, 用 flask 的应该很少人还在用 0.10 吧
pengbo37877
2016-05-30 11:01:44 +08:00
为啥不用 Laravel
echo1937
2016-05-30 11:03:36 +08:00
@Zzzzzzzzz 萌新请教, 0.11 刚发布,之前大家用什么版本?
9hills
2016-05-30 11:17:45 +08:00
这个手伸的有点长。。。
Zzzzzzzzz
2016-05-30 11:19:53 +08:00
@echo1937 就我接触过的用 flask 基本都在 github 上的开发版, flask 0.11 这些修改基本都是三年前就进仓库的, 作者本来憋个 1.0 , 后来又是去玩 rust 又是有其他想法的就耗住了, 这几年大部分推送都是针对 typo 和文档改进, 开发版比 0.10 可靠得多.
0bit
2016-05-30 11:28:14 +08:00
顺手贴一个官方地址,看着更清晰一点:
http://flask.pocoo.org/docs/0.11/changelog/#version-0-11
srlp
2016-05-30 12:51:58 +08:00
json 相关函数改进了,引入了 flask-script 的部分设计
evitceted
2016-05-30 15:05:38 +08:00
Flask 1.0 还没有啊?
aljun
2016-05-31 01:06:34 +08:00
那我前几天还自己折腾了一个 web framework⋯⋯


贴个文档地址
http://jolla.readthedocs.io/zh/latest/
sqbing
2016-05-31 08:21:34 +08:00
@xuwenmang 黑的漂亮
smallghost
2016-05-31 10:25:27 +08:00

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/282135

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX