def __init__(self, prefix, routes):
"""Initializes a URL route.
:param prefix:
The prefix to be prepended.
:param routes:
A list of :class:`webapp2.Route` instances.
"""
super(NamePrefixRoute, self).__init__(routes)
self.prefix = prefix
# Prepend a prefix to a route attribute.
for route in self.get_routes():
setattr(route, self._attr, prefix + getattr(route, self._attr))
评论列表
文章目录