Andriy Kornatskyy avatar Andriy Kornatskyy committed a80b26e

While adding route be more explicit concerning finishing route

Comments (0)

Files changed (9)

demos/hello/helloworld.py

     yield ntob('Hello World!', 'utf-8')
 
 
+def not_found(environ, start_response):
+    start_response('404 Not Found', [
+        ('Content-Type', 'text/html')
+    ])
+    yield ntob('', 'utf-8')
+
+
 r = PathRouter()
 r.add_routes([
-    ('/', hello_world)
+    ('/', hello_world),
+    ('/{any}', not_found)
 ])
 
 

demos/hello/test_helloworld.py

     """ Test the ``main`` funcation call.
     """
 
-    def test_any_path_match(self):
+    def test_hello_match(self):
         """
         """
         from helloworld import main
 
         def start_response(status, response_headers):
-            pass
+            self.assertEquals('200 OK', status)
 
-        for path in ('/', '/Welcome'):
+        environ = {'PATH_INFO': '/'}
+        response = list(map(lambda c: c.decode('utf-8'),
+            main(environ, start_response)))
+
+        self.assertEquals(['Hello World!'], response)
+
+    def test_any_path_match(self):
+        """
+        """
+        from helloworld import main
+
+        def start_response(status, response_headers):
+            self.assertEquals('404 Not Found', status)
+
+        for path in ('/a', '/b'):
             environ = {'PATH_INFO': path}
             response = list(map(lambda c: c.decode('utf-8'),
                 main(environ, start_response)))
 
-            self.assertEquals(['Hello World!'], response)
+            self.assertEquals([''], response)

src/wheezy/routing/builders.py

 RE_PLAIN_ROUTE = re.compile('^[\w/-]+$')
 
 
-def try_build_plain_route(pattern, kwargs=None):
+def try_build_plain_route(pattern, finishing, kwargs=None):
     """ If the plain route regular expression match the pattern
         than create a PlainRoute instance.
 
-        >>> r = try_build_plain_route(r'abc')
+        >>> r = try_build_plain_route(r'abc', True)
         >>> assert isinstance(r, PlainRoute)
 
         Otherwise return None.
 
-        >>> r = try_build_plain_route(r'ab[c]')
+        >>> r = try_build_plain_route(r'ab[c]', False)
         >>> assert r is None
     """
     if pattern == '' or RE_PLAIN_ROUTE.match(pattern):
-        return PlainRoute(pattern, kwargs)
+        return PlainRoute(pattern, finishing, kwargs)
     return None
 
 
-def try_build_curly_route(pattern, kwargs=None):
+def try_build_curly_route(pattern, finishing, kwargs=None):
     """ Convert pattern expression into regex with
         named groups and create regex route.
 
-        >>> r = try_build_curly_route('abc/{n}')
+        >>> r = try_build_curly_route('abc/{n}', True)
         >>> assert isinstance(r, RegexRoute)
 
         Otherwise return None.
 
-        >>> r = try_build_curly_route('abc')
+        >>> r = try_build_curly_route('abc', True)
     """
     if RE_CURLY_ROUTE.search(pattern):
-        return RegexRoute(curly_convert(pattern), kwargs)
+        return RegexRoute(curly_convert(pattern), finishing, kwargs)
     return None
 
 
-def try_build_regex_route(pattern, kwargs=None):
+def try_build_regex_route(pattern, finishing, kwargs=None):
     """ There is no special tests to match regex selection
         strategy.
 
-        >>> r = try_build_regex_route(r'abc')
+        >>> r = try_build_regex_route(r'abc', True)
         >>> assert isinstance(r, RegexRoute)
     """
-    return RegexRoute(pattern, kwargs)
+    return RegexRoute(pattern, finishing, kwargs)
 
 
-def build_route(pattern, kwargs, route_builders):
+def build_route(pattern, finishing, kwargs, route_builders):
     """ If ``pattern`` is an object drived from ``Route`` than it
         simply returned.
 
-        >>> pattern = PlainRoute(r'abc')
-        >>> r = build_route(pattern, None, [])
+        >>> pattern = PlainRoute(r'abc', False)
+        >>> r = build_route(pattern, False, None, [])
         >>> assert pattern == r
 
         If ``pattern`` is a string than try to find
         sutable route builder to create a route.
 
         >>> from wheezy.routing.config import route_builders
-        >>> r = build_route(r'abc', {'a': 1}, route_builders)
+        >>> r = build_route(r'abc', False, {'a': 1}, route_builders)
         >>> assert isinstance(r, PlainRoute)
         >>> r.kwargs
         {'a': 1}
 
         Otherwise raise LookupError
 
-        >>> r = build_route(r'abc', None, [])
+        >>> r = build_route(r'abc', None, False, [])
         Traceback (most recent call last):
             ...
         LookupError: No matching route factory found
         route = pattern
     else:
         for try_build_route in route_builders:
-            route = try_build_route(pattern, kwargs)
+            route = try_build_route(pattern, finishing, kwargs)
             if route:
                 break
         else:

src/wheezy/routing/route.py

 
 import re
 
-from wheezy.routing.comp import basestring
 from wheezy.routing.utils import merge
 from wheezy.routing.utils import outer_split
 
     """ Route based on string equalty operation.
     """
 
-    def __init__(self, pattern, kwargs=None):
+    def __init__(self, pattern, finishing, kwargs=None):
         """ Initializes the route by given ``pattern``. If
-            pattern ends with ``/`` than it select ``startswith``
-            strategy.
+            ``finishing`` is True than choose ``equals_math``
+            strategy
 
-            >>> r = PlainRoute(r'abc/')
+            >>> r = PlainRoute(r'abc', True)
+            >>> assert r.match == r.equals_match
+
+            Otherwise ``startswith_match`` strategy is selected.
+
+            >>> r = PlainRoute(r'abc', False)
             >>> assert r.match == r.startswith_match
-
-            Otherwise ``equals`` strategy is selected.
-
-            >>> r = PlainRoute(r'abc')
-            >>> assert r.match == r.equals_match
         """
         self.pattern = pattern
         self.kwargs = kwargs
         self.matched = len(pattern)
         # Choose match strategy
-        self.match = pattern[-1:] == '/' \
-                and self.startswith_match \
-                or self.equals_match
+        self.match = finishing and self.equals_match \
+                or self.startswith_match
 
     def equals_match(self, path):
         """ If the ``path`` exactly equals pattern string,
             return end index of substring matched and a copy
             of ``self.kwargs``.
 
-            >>> r = PlainRoute(r'abc')
+            >>> r = PlainRoute(r'abc', True)
             >>> matched, kwargs = r.equals_match('abc')
             >>> matched
             3
 
             Match returns ``self.kwargs``.
 
-            >>> r = PlainRoute(r'abc', {'a': 1})
+            >>> r = PlainRoute(r'abc', True, {'a': 1})
             >>> matched, kwargs = r.equals_match('abc')
             >>> matched
             3
         """ If the ``path`` starts with pattern string, return
             the end of substring matched and ``self.kwargs``.
 
-            >>> r = PlainRoute(r'abc')
+            >>> r = PlainRoute(r'abc', False)
             >>> matched, kwargs = r.startswith_match('abc')
             >>> matched
             3
 
             Match returns ``self.kwargs``.
 
-            >>> r = PlainRoute(r'abc', {'a': 1})
+            >>> r = PlainRoute(r'abc', False, {'a': 1})
             >>> matched, kwargs = r.startswith_match('abc/')
             >>> matched
             3
         """ Build the path for given route by simply returning
             the pattern used during initialization.
 
-            >>> r = PlainRoute(r'abc')
+            >>> r = PlainRoute(r'abc', True)
             >>> r.path()
             'abc'
         """
     """ Route based on regular expression matching.
     """
 
-    def __init__(self, pattern, kwargs=None):
-        self.pattern = pattern
-        self.kwargs = kwargs
-        self.regex = re.compile(pattern)
-
+    def __init__(self, pattern, finishing, kwargs=None):
+        pattern = pattern.lstrip('^').rstrip('$')
         # Choose match strategy
         if kwargs:
             def value_provider(name):
-                self.kwargs.setdefault(name, '')
+                kwargs.setdefault(name, '')
                 return lambda values: str(values[name])
             self.match = self.match_with_kwargs
             self.path = self.path_with_kwargs
                 return lambda values: str(values.get(name, ''))
             self.match = self.match_no_kwargs
             self.path = self.path_no_kwargs
+
         self.parts = parse_pattern(pattern, value_provider)
+        pattern = '^' + pattern
+        if finishing:
+            pattern = pattern + '$'
+        self.kwargs = kwargs
+        self.regex = re.compile(pattern)
 
     def match_no_kwargs(self, path):
         """ If the ``path`` match the regex pattern.
 
-            >>> r = RegexRoute(r'abc/(?P<id>\d+$)')
+            >>> r = RegexRoute(r'abc/(?P<id>\d+$)', True)
             >>> matched, kwargs = r.match_no_kwargs('abc/1234')
             >>> matched
             8
     def match_with_kwargs(self, path):
         """ If the ``path`` match the regex pattern.
 
-            >>> r = RegexRoute(r'abc/\d+', {'lang': 'en'})
+            >>> r = RegexRoute(r'abc/\d+', False, {'lang': 'en'})
             >>> matched, kwargs = r.match_with_kwargs('abc/1234')
             >>> matched
             8
             >>> kwargs
             {'lang': 'en'}
 
-            >>> r = RegexRoute(r'abc/(?P<id>\d+$)', {
+            >>> r = RegexRoute(r'abc/(?P<id>\d+$)', True, {
             ...     'lang': 'en'
             ... })
             >>> matched, kwargs = r.match_with_kwargs('abc/1234')
             ``kwargs`` from ``pattern`` match must override
             defaults.
 
-            >>> r = RegexRoute(r'abc/?(?P<id>\d*$)', {'id': '1'})
+            >>> r = RegexRoute(r'abc/?(?P<id>\d*$)', True, {'id': '1'})
             >>> matched, kwargs = r.match_with_kwargs('abc')
             >>> kwargs
             {'id': '1'}
             the named places of the regual expression.
 
             >>> r = RegexRoute(
-            ...     r'abc/(?P<month>\d+)/(?P<day>\d+)'
+            ...     r'abc/(?P<month>\d+)/(?P<day>\d+)',
+            ...     True
             ... )
             >>> r.path_no_kwargs(dict(month=6, day=9))
             'abc/6/9'
 
             >>> r = RegexRoute(
             ...     r'abc/(?P<month>\d+)/(?P<day>\d+)',
+            ...     True,
             ...     dict(month=1, day=1)
             ... )
             >>> r.path_with_kwargs(dict(month=6, day=9))

src/wheezy/routing/router.py

         name = name or route_name(handler)
         kwargs = kwargs or {}
         kwargs['route_name'] = name
-        route = build_route(pattern, kwargs, self.route_builders)
+        # build finishing route
+        route = build_route(pattern, True, kwargs, self.route_builders)
         self.route_map[name] = route
         self.mapping.append((route, handler))
 
             >>> assert inner == inner2
             >>> assert isinstance(inner, PathRouter)
         """
-        route = build_route(pattern, kwargs, self.route_builders)
+        # try build intermediate route
+        route = build_route(pattern, False, kwargs, self.route_builders)
         inner = PathRouter(self.route_builders)
         inner.add_routes(included)
         self.mapping.append((route, inner))
                 pattern, handler, kwargs = m
             else:
                 pattern, handler, kwargs, name = m
-
             if isinstance(handler, (tuple, list, PathRouter)):
                 self.include(pattern, handler, kwargs)
             else:

src/wheezy/routing/tests/test_builders.py

         from wheezy.routing.builders import try_build_plain_route
         from wheezy.routing.route import PlainRoute
 
-        r = try_build_plain_route(r'abc')
+        r = try_build_plain_route(r'abc', False)
         assert isinstance(r, PlainRoute)
         assert not r.kwargs
 
         from wheezy.routing.builders import try_build_plain_route
         from wheezy.routing.route import PlainRoute
 
-        r = try_build_plain_route(r'')
+        r = try_build_plain_route(r'', False)
         assert isinstance(r, PlainRoute)
         assert not r.kwargs
 
         """
         from wheezy.routing.builders import try_build_plain_route
 
-        r = try_build_plain_route(r'abc', {'a': 1})
+        r = try_build_plain_route(r'abc', False, {'a': 1})
 
         self.assertEqual({'a': 1}, r.kwargs)
 
         """
         from wheezy.routing.builders import try_build_plain_route
 
-        r = try_build_plain_route(r'abc/{name}')
+        r = try_build_plain_route(r'abc/{name}', False)
 
         assert r is None
 
         """
         from wheezy.routing.builders import try_build_curly_route
 
-        r = try_build_curly_route(r'abc')
+        r = try_build_curly_route(r'abc', False)
         assert r is None
 
     def test_match(self):
         from wheezy.routing.builders import try_build_curly_route
         from wheezy.routing.route import RegexRoute
 
-        r = try_build_curly_route(r'abc/{n}')
+        r = try_build_curly_route(r'abc/{n}', False)
         assert isinstance(r, RegexRoute)
 
     def test_pattern_name(self):
         from wheezy.routing.builders import try_build_curly_route
         from wheezy.routing.route import RegexRoute
 
-        r = try_build_curly_route(r'abc/{n:i}')
+        r = try_build_curly_route(r'abc/{n:i}', False)
         assert isinstance(r, RegexRoute)
 
 
         from wheezy.routing.builders import try_build_regex_route
         from wheezy.routing.route import RegexRoute
 
-        r = try_build_regex_route(r'abc')
+        r = try_build_regex_route(r'abc', False)
         assert isinstance(r, RegexRoute)
 
 
 
         r = Route()
 
-        self.assertEqual(r, build_route(r, None, None))
+        self.assertEqual(r, build_route(r, False, None, None))
 
     def test_found(self):
         """ Sutable route strategy has been found.
         from wheezy.routing.builders import build_route
         from wheezy.routing import config
 
-        r = build_route(r'abc', {'a': 1}, config.route_builders)
+        r = build_route(r'abc', False, {'a': 1}, config.route_builders)
 
         assert r
         self.assertEqual({'a': 1}, r.kwargs)
         mock = m.mock
         builders = mock(), mock(), mock(), mock(), mock()
         b1, b2, b3, b4, b5 = builders
-        expect(b1(r'abc', None)).result(None)
-        expect(b2(r'abc', None)).result(None)
-        expect(b3(r'abc', None)).result('x')
+        expect(b1(r'abc', False, None)).result(None)
+        expect(b2(r'abc', False, None)).result(None)
+        expect(b3(r'abc', False, None)).result('x')
         m.replay()
 
-        r = build_route(r'abc', None, builders)
+        r = build_route(r'abc', False, None, builders)
 
         self.assertEqual('x', r)
         m.verify()
         mock = m.mock
         builders = mock(), mock()
         b1, b2 = builders
-        expect(b1(r'abc', None)).result(None)
-        expect(b2(r'abc', None)).result(None)
+        expect(b1(r'abc', False, None)).result(None)
+        expect(b2(r'abc', False, None)).result(None)
         m.replay()
 
         self.assertRaises(LookupError,
-                lambda: build_route(r'abc', None, builders))
+                lambda: build_route(r'abc', False, None, builders))
         m.verify()
 
 
         from wheezy.routing.builders import build_route
         from wheezy.routing.route import PlainRoute
 
-        r = build_route(r'abc', None,  config.route_builders)
+        r = build_route(r'abc', False, None, config.route_builders)
 
         assert isinstance(r, PlainRoute)
 
-    def test_match_curly_route(self):
+    def test_match_curly_route_intermediate(self):
         """ the chain of strategies match regex route.
         """
         from wheezy.routing import config
 
         r = build_route(
                 r'abc/{id}',
+                False,
                 None,
                 config.route_builders
         )
 
         assert isinstance(r, RegexRoute)
-        self.assertEquals('abc/(?P<id>[^/]+)', r.pattern)
+        self.assertEquals('^abc/(?P<id>[^/]+)', r.regex.pattern)
+
+    def test_match_curly_route_finishing(self):
+        """ the chain of strategies match regex route.
+        """
+        from wheezy.routing import config
+        from wheezy.routing.builders import build_route
+        from wheezy.routing.route import RegexRoute
+
+        r = build_route(
+                r'abc/{id}',
+                True,
+                None,
+                config.route_builders
+        )
+
+        assert isinstance(r, RegexRoute)
+        self.assertEquals('^abc/(?P<id>[^/]+)$', r.regex.pattern)
 
     def test_match_regex_route(self):
         """ the chain of strategies match regex route.
 
         r = build_route(
                 r'abc/(?P<id>\d+)',
+                False,
                 None,
                 config.route_builders
         )

src/wheezy/routing/tests/test_config.py

             assert callable(builder)
             args, varargs, keywords, defaults = \
                     inspect.getargspec(builder)
-            self.assertEqual(['pattern', 'kwargs'], args)
+            self.assertEqual(['pattern', 'finishing', 'kwargs'], args)
             self.assertEqual(None, varargs)
             self.assertEqual(None, keywords)
             self.assertEqual((None,), defaults)

src/wheezy/routing/tests/test_route.py

     """
 
     def test_equals(self):
-        """ ``pattern`` does not end with ``/``.
+        """ Finishing route.
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc')
+        r = PlainRoute(r'abc', True)
 
         assert r.equals_match == r.match
 
     def test_startswith(self):
-        """ ``pattern`` ends with ``/``.
+        """ Intermediate route.
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc/')
+        r = PlainRoute(r'abc/', False)
 
         assert r.startswith_match == r.match
 
         from wheezy.routing.route import PlainRoute
 
         kw = {'a': 1}
-        r = PlainRoute(r'abc', kw)
+        r = PlainRoute(r'abc', True, kw)
 
         self.assertEquals(r'abc', r.pattern)
         self.assertEquals(kw, r.kwargs)
         from wheezy.routing.route import PlainRoute
 
         kw = {'a': 1}
-        r = PlainRoute(r'abc', kw)
+        r = PlainRoute(r'abc', True, kw)
 
         matched, kwargs = r.equals_match(r'abc')
         self.assertEquals(3, matched)
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc')
+        r = PlainRoute(r'abc', True)
         matched, kwargs = r.equals_match(r'abc')
         self.assertEquals(3, matched)
         self.assertEquals(None, r.kwargs)
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc')
+        r = PlainRoute(r'abc', True)
         matched, kwargs = r.equals_match(r'ab')
         self.assertEquals(-1, matched)
 
         from wheezy.routing.route import PlainRoute
 
         kw = {'a': 1}
-        r = PlainRoute(r'abc/', kw)
+        r = PlainRoute(r'abc/', False, kw)
         matched, kwargs = r.startswith_match(r'abc/de')
         self.assertEquals(4, matched)
         self.assertEquals(kw, kwargs)
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc/')
+        r = PlainRoute(r'abc/', False)
         matched, kwargs = r.startswith_match(r'abc/de')
         self.assertEquals(4, matched)
         self.assertEquals(None, r.kwargs)
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc/')
+        r = PlainRoute(r'abc/', False)
         matched, kwargs = r.equals_match(r'ab')
         self.assertEquals(-1, matched)
 
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc/')
+        r = PlainRoute(r'abc/', False)
         p = r.path()
         self.assertEquals(p, r.pattern)
 
         """
         from wheezy.routing.route import PlainRoute
 
-        r = PlainRoute(r'abc/', {'a': 1})
+        r = PlainRoute(r'abc/', True, {'a': 1})
         p = r.path({'b': 2})
         self.assertEquals(p, r.pattern)
 
         """
         from wheezy.routing.route import RegexRoute
 
-        r = RegexRoute(r'abc', {'a': 1})
+        r = RegexRoute(r'abc', False, {'a': 1})
+
+        assert r.match == r.match_with_kwargs
 
     def test_no_kwargs(self):
         """ If kwargs omitted than choose
         """
         from wheezy.routing.route import RegexRoute
 
-        r = RegexRoute(r'abc')
+        r = RegexRoute(r'abc', True)
+
+        assert r.match == r.match_no_kwargs
 
 
 class RegexRouteInitPartsTestCase(unittest.TestCase):
     """ Test the ``RegexRoute.match_no_kwargs``.
     """
 
-    def test_no_match(self):
+    def test_no_match_intermediate(self):
         """ there is no match.
         """
         from wheezy.routing.route import RegexRoute
 
-        r = RegexRoute(r'abc')
-        matched, kwargs = r.match('bc')
+        r = RegexRoute(r'abc', False)
+        matched, kwargs = r.match('ab')
 
         self.assertEquals(-1, matched)
         assert not kwargs
 
-    def test_match(self):
+    def test_no_match_finishing(self):
+        """ there is no match.
+        """
+        from wheezy.routing.route import RegexRoute
+
+        r = RegexRoute(r'abc', True)
+        matched, kwargs = r.match('abcd')
+
+        self.assertEquals(-1, matched)
+        assert not kwargs
+
+    def test_match_intermediate(self):
         """ there is a match.
         """
         from wheezy.routing.route import RegexRoute
 
-        r = RegexRoute(r'abc')
+        r = RegexRoute(r'abc', False)
         matched, kwargs = r.match('abcd')
 
         self.assertEquals(3, matched)
         assert not kwargs
 
+    def test_match_finishing(self):
+        """ there is a match.
+        """
+        from wheezy.routing.route import RegexRoute
+
+        r = RegexRoute(r'abc', True)
+        matched, kwargs = r.match('abc')
+
+        self.assertEquals(3, matched)
+        assert not kwargs
+
 
 class RegexRouteMatchWithKwargsPartsTestCase(unittest.TestCase):
     """ Test the ``RegexRoute.match_with_kwargs``.
         from wheezy.routing.route import RegexRoute
 
         kw = {'a': 1}
-        r = RegexRoute(r'abc', kw)
+        r = RegexRoute(r'abc', False, kw)
         matched, kwargs = r.match('abcd')
 
         self.assertEquals(3, matched)
         from wheezy.routing.route import RegexRoute
 
         kw = {'a': 1}
-        r = RegexRoute(r'abc/(?P<b>\d+)', kw)
+        r = RegexRoute(r'abc/(?P<b>\d+)', True, kw)
         matched, kwargs = r.match('abc/2')
 
         self.assertEquals(5, matched)
     def setUp(self):
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(r'abc/(?P<a>\d+)')
+        self.r = RegexRoute(r'abc/(?P<a>\d+)', False)
 
     def test_no_values(self):
         """
     def setUp(self):
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(r'abc/(?P<a>\d+)')
+        self.r = RegexRoute(r'abc/(?P<a>\d+)', True)
 
     def test_no_values(self):
         """
     def setUp(self):
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(r'abc/(?P<a>\d+)', {'a': 1})
+        self.r = RegexRoute(r'abc/(?P<a>\d+)', True, {'a': 1})
 
     def test_no_values(self):
         """
         from wheezy.routing.curly import convert
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(convert('abc/{id:int}'))
+        self.r = RegexRoute(convert('abc/{id:int}'), True)
 
     def test_match(self):
         """ match
         from wheezy.routing.curly import convert
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(convert('abc/{id:word}'))
+        self.r = RegexRoute(convert('abc/{id:word}'), True)
 
     def test_match(self):
         """ match
         from wheezy.routing.curly import convert
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(convert('abc/{id:segment}'))
+        self.r = RegexRoute(convert('abc/{id:segment}'), False)
 
     def test_match(self):
         """ match
         from wheezy.routing.curly import convert
         from wheezy.routing.route import RegexRoute
 
-        self.r = RegexRoute(convert('abc/{id:any}'))
+        self.r = RegexRoute(convert('abc/{id:any}'), True)
 
     def test_match(self):
         """ match

src/wheezy/routing/tests/test_router.py

         """ custom route builders.
         """
         from wheezy.routing.router import PathRouter
-        from wheezy.routing import config
 
         route_builders = ('x')
         r = PathRouter(route_builders)
         kw = {'a': 1}
         mock_build_route = self.m.replace(builders.build_route)
         expect(
-            mock_build_route('abc', kw, self.r.route_builders)
+            mock_build_route('abc', True, kw, self.r.route_builders)
         ).result('x')
         self.m.replay()
 
         kw = {'a': 1}
         mock_build_route = self.m.replace(builders.build_route)
         expect(
-            mock_build_route('abc', kw, self.r.route_builders)
+            mock_build_route('abc', False, kw, self.r.route_builders)
         ).result('x')
         self.m.replay()
 
         mock_route = self.m.mock()
         mock_build_route = self.m.replace(builders.build_route)
         expect(
-                mock_build_route('', {'route_name': 'x'},
+                mock_build_route('', True,
+                    {'route_name': 'x'},
                     self.r.route_builders)
         ).result(mock_route)
         expect(mock_route.match('')).result((0, None))
         expect(
                 mock_build_route(
                     'abc',
+                    True,
                     {'route_name': 'n'},
                     self.r.route_builders)
         ).result(mock_route)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.