handler.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:MKFQ 作者: maojingios 项目源码 文件源码
def _GivePropertiesFromGeneralToSpecific(handler_list):
  """Makes sure that handlers have all properties of more general ones.

  Ex. Since "*" matches everything "admin/*" matches, we want everything
  matched by "admin/*" to have all the properties specified to "*".
  Therefore we give properties from the "*" handler to the "admin/*" handler.
  If the "*" handler is a SimpleHandler, it carries its own properties, so it
  becomes a child of the "admin/*" handler. Otherwise, its properties are
  define by its children, so its children are copied to the "admin/*"
  handler.

  This is an in-place mutation of the list.

  Args:
    handler_list: List of ordered Handlers.
  """
  for i, j in itertools.combinations(xrange(len(handler_list)), 2):
    if handler_list[j].MatchesAll(handler_list[i]):
      if isinstance(handler_list[i], SimpleHandler):
        handler_list[i] = handler_list[i].CreateOverlappedHandler()
      handler_list[i].AddMatchingHandler(handler_list[j])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号