Tornado Documentation
https://v2ex.ih06.com/tornado/
Tornado on GitHub
https://github.com/facebook/tornado/
Tornado Gists
http://tornadogists.org/
paulguo
V2EX  ›  Tornado

如何在某个Handler中调用另一个Handler的方法?

  •  
  •   paulguo · Dec 8, 2012 · 6132 views
    This topic created in 5006 days ago, the information mentioned may be changed or developed.
    比如

    class AHandler(BaseHandler):
    def get(self):
    // do sth

    class BHandler(BaseHandler):
    def get(self):
    // 调用 AHandler.get() ?
    2 replies    1970-01-01 08:00:00 +08:00
    reorx
        1
    reorx  
       Dec 8, 2012   ❤️ 2
    不能直接调用另一个 handler 的 http 方法,如果两个 get 有相同的部分,把那一部分提取出来写成 mixin class 的方法,然后让两个 handler 都继承它。

    http://gist.github.com/4240166
    paulguo
        2
    paulguo  
    OP
       Dec 8, 2012
    @reorx thx. :)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3542 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 00:18 · PVG 08:18 · LAX 17:18 · JFK 20:18
    ♥ Do have faith in what you're doing.