Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
tornadoweb
Tornado
提交
11399532
Tornado
项目概览
镜像
/
tornadoweb
/
Tornado
10 个月 前同步成功
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Tornado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
11399532
编写于
4月 27, 2018
作者:
B
Ben Darnell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
web: Deprecate callback argument to RequestHandler.flush
Also deprecates callback arguments in httputil and http1connection
上级
c60ab672
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
2 deletion
+19
-2
tornado/http1connection.py
tornado/http1connection.py
+5
-0
tornado/httputil.py
tornado/httputil.py
+10
-0
tornado/test/web_test.py
tornado/test/web_test.py
+4
-2
未找到文件。
tornado/http1connection.py
浏览文件 @
11399532
...
...
@@ -21,6 +21,7 @@
from
__future__
import
absolute_import
,
division
,
print_function
import
re
import
warnings
from
tornado.concurrent
import
(
Future
,
future_add_done_callback
,
future_set_result_unless_cancelled
)
...
...
@@ -401,6 +402,8 @@ class HTTP1Connection(httputil.HTTPConnection):
future
.
exception
()
else
:
if
callback
is
not
None
:
warnings
.
warn
(
"callback argument is deprecated, use returned Future instead"
,
DeprecationWarning
)
self
.
_write_callback
=
stack_context
.
wrap
(
callback
)
else
:
future
=
self
.
_write_future
=
Future
()
...
...
@@ -440,6 +443,8 @@ class HTTP1Connection(httputil.HTTPConnection):
self
.
_write_future
.
exception
()
else
:
if
callback
is
not
None
:
warnings
.
warn
(
"callback argument is deprecated, use returned Future instead"
,
DeprecationWarning
)
self
.
_write_callback
=
stack_context
.
wrap
(
callback
)
else
:
future
=
self
.
_write_future
=
Future
()
...
...
tornado/httputil.py
浏览文件 @
11399532
...
...
@@ -591,6 +591,11 @@ class HTTPConnection(object):
The ``version`` field of ``start_line`` is ignored.
Returns a `.Future` if no callback is given.
.. deprecated:: 5.1
The ``callback`` argument is deprecated and will be removed
in Tornado 6.0.
"""
raise
NotImplementedError
()
...
...
@@ -599,6 +604,11 @@ class HTTPConnection(object):
The callback will be run when the write is complete. If no callback
is given, returns a Future.
.. deprecated:: 5.1
The ``callback`` argument is deprecated and will be removed
in Tornado 6.0.
"""
raise
NotImplementedError
()
...
...
tornado/test/web_test.py
浏览文件 @
11399532
...
...
@@ -555,11 +555,13 @@ class FlowControlHandler(RequestHandler):
@
asynchronous
def
get
(
self
):
self
.
write
(
"1"
)
self
.
flush
(
callback
=
self
.
step2
)
with
ignore_deprecation
():
self
.
flush
(
callback
=
self
.
step2
)
def
step2
(
self
):
self
.
write
(
"2"
)
self
.
flush
(
callback
=
self
.
step3
)
with
ignore_deprecation
():
self
.
flush
(
callback
=
self
.
step3
)
def
step3
(
self
):
self
.
write
(
"3"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录