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])
评论列表
文章目录