Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我以这种方式定义了路线:
webapp2.Route(r'/v/<link:\d+>', handler=View),
现在我想创建另一个特定的 Route link。就像是:
link
webapp2.Route(r'/test', handler=View('specific link')),
有没有办法以这种方式创建路线?或者我应该创建新的处理程序并在这个处理程序中调用另一个预定义的处理程序link?如果是,我该如何实现?
有一种方法可以为 RequestHandler 提供带有默认参数的字典:
webapp2.Route(r'/test', handler=View, defaults={'link': 'default_link'}),