首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
Tornado Documentation
›
http://www.v2ex.com/tornado/
Tornado on GitHub
›
https://github.com/facebook/tornado/
Tornado Gists
›
http://tornadogists.org/
V2EX
›
Tornado
如何在某个Handler中调用另一个Handler的方法?
paulguo
·
2012-12-08 19:32:06 +08:00
· 5452 次点击
这是一个创建于 4454 天前的主题,其中的信息可能已经有所发展或是发生改变。
比如
class AHandler(BaseHandler):
def get(self):
// do sth
class BHandler(BaseHandler):
def get(self):
// 调用 AHandler.get() ?
get
self
def
2 条回复
•
1970-01-01 08:00:00 +08:00
1
reorx
2012-12-08 21:00:26 +08:00
2
不能直接调用另一个 handler 的 http 方法,如果两个 get 有相同的部分,把那一部分提取出来写成 mixin class 的方法,然后让两个 handler 都继承它。
http://gist.github.com/4240166
2
paulguo
OP
2012-12-08 21:44:43 +08:00
@
reorx
thx. :)
关于
·
帮助文档
·
博客
·
API
·
FAQ
·
实用小工具
·
5520 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 21ms ·
UTC 08:16
·
PVG 16:16
·
LAX 00:16
·
JFK 03:16
Developed with
CodeLauncher
♥ Do have faith in what you're doing.