Пример #1
0
 def match(self, path):
   """
     Returns the first route matching path. Returns None if no matches were
     found.
   """
   return self.get(parse_path(path), RouteList()).match(path)
Пример #2
0
 def should_turn_paths_into_tuples(self):
   self.assertEqual(('home', 'index', 'weeble'), parse_path('/home/index/weeble'))
   self.assertEqual(('home', 'index', 'weeble'), parse_path('/home/index/weeble/'))
   self.assertEqual(('home', 'index', 'weeble'), parse_path('home/index/weeble'))
   self.assertEqual(('home', 'index', 'weeble'), parse_path('home/index/weeble/'))
Пример #3
0
 def add(self, route):
   """
     Adds route to the tree for each path in route.paths().
   """
   for path in route.paths():
     self.setdefault(parse_path(path), RouteList()).add(route)