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

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

  •  
  •   paulguo · Dec 8, 2012 · 6224 views
    This topic created in 5059 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   ·   Privacy   ·   Solana   ·   1009 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 22:31 · PVG 06:31 · LAX 15:31 · JFK 18:31
    ♥ Do have faith in what you're doing.