diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-09-08 04:25:35 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-09-08 04:25:35 +0000 |
| commit | 74409d12f7eb085bc992a200cc74799e4d1ff355 (patch) | |
| tree | 14b10948171be45b425f87122be156a7dc11c117 /repoze/bfg/tests/test_router.py | |
| parent | 68469214646debcdcea662f34b41f41e0ae8db12 (diff) | |
| download | pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.tar.gz pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.tar.bz2 pyramid-74409d12f7eb085bc992a200cc74799e4d1ff355.zip | |
- The ``repoze.bfg.urldispatch.Route`` constructor (not an API) now
accepts a different ordering of arguments. Previously it was
``(pattern, name, factory=None, predicates=())``. It is now
``(name, pattern, factory=None, predicates=())``. This is in
support of consistency with ``configurator.add_route``.
- The ``repoze.bfg.urldispatch.RoutesMapper.connect`` method (not an
API) now accepts a different ordering of arguments. Previously it
was ``(pattern, name, factory=None, predicates=())``. It is now
``(name, pattern, factory=None, predicates=())``. This is in
support of consistency with ``configurator.add_route``.
- The ``repoze.bfg.urldispatch.RoutesMapper`` object now has a
``get_route`` method which returns a single Route object or
``None``.
- A new interface ``repoze.bfg.interfaces.IRoute`` was added. The
``repoze.bfg.urldispatch.Route`` object implements this interface.
- The canonical attribute for accessing the routing pattern from a
route object is now ``pattern`` rather than ``path``.
- The argument to ``repoze.bfg.configuration.Configurator.add_route``
which was previously called ``path`` is now called ``pattern`` for
better explicability. For backwards compatibility purposes, passing
a keyword argument named ``path`` to ``add_route`` will still work
indefinitely.
- The ``path`` attribute to the ZCML ``route`` directive is now named
``pattern`` for better explicability. The older ``path`` attribute
will continue to work indefinitely.
- All narrative, API, and tutorial docs which referred to a route
pattern as a ``path`` have now been updated to refer to them as a
``pattern``.
- The routesalchemy template has been updated to use ``pattern`` in
its route declarations rather than ``path``.
Diffstat (limited to 'repoze/bfg/tests/test_router.py')
| -rw-r--r-- | repoze/bfg/tests/test_router.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/repoze/bfg/tests/test_router.py b/repoze/bfg/tests/test_router.py index 1ce499e41..c243d739e 100644 --- a/repoze/bfg/tests/test_router.py +++ b/repoze/bfg/tests/test_router.py @@ -18,14 +18,14 @@ class TestRouter(unittest.TestCase): self.registry.registerUtility(iface, IRouteRequest, name=name) return iface - def _connectRoute(self, path, name, factory=None): + def _connectRoute(self, name, path, factory=None): from repoze.bfg.interfaces import IRoutesMapper from repoze.bfg.urldispatch import RoutesMapper mapper = self.registry.queryUtility(IRoutesMapper) if mapper is None: mapper = RoutesMapper() self.registry.registerUtility(mapper, IRoutesMapper) - mapper.connect(path, name, factory) + mapper.connect(name, path, factory) def _registerLogger(self): from repoze.bfg.interfaces import IDebugLogger @@ -444,7 +444,7 @@ class TestRouter(unittest.TestCase): root = object() def factory(request): return root - self._connectRoute('archives/:action/:article', 'foo', factory) + self._connectRoute('foo', 'archives/:action/:article', factory) context = DummyContext() self._registerTraverserFactory(context) response = DummyResponse() @@ -485,7 +485,7 @@ class TestRouter(unittest.TestCase): root = object() def factory(request): return root - self._connectRoute('archives/:action/:article', 'foo', factory) + self._connectRoute('foo', 'archives/:action/:article', factory) context = DummyContext() self._registerTraverserFactory(context) response = DummyResponse() @@ -727,7 +727,7 @@ class TestRouter(unittest.TestCase): from repoze.bfg.interfaces import IViewClassifier from repoze.bfg.interfaces import IExceptionViewClassifier req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=RuntimeError) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -746,7 +746,7 @@ class TestRouter(unittest.TestCase): from repoze.bfg.interfaces import IExceptionViewClassifier from repoze.bfg.interfaces import IRequest req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=RuntimeError) self._registerView(view, '', IViewClassifier, IRequest, None) response = DummyResponse() @@ -764,7 +764,7 @@ class TestRouter(unittest.TestCase): from repoze.bfg.interfaces import IExceptionViewClassifier from repoze.bfg.interfaces import IRequest req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=RuntimeError) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -787,7 +787,7 @@ class TestRouter(unittest.TestCase): class SubException(SuperException): pass req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=SuperException) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -809,7 +809,7 @@ class TestRouter(unittest.TestCase): class SubException(SuperException): pass req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=SubException) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -832,7 +832,7 @@ class TestRouter(unittest.TestCase): class AnotherException(Exception): pass req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=MyException) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -850,7 +850,7 @@ class TestRouter(unittest.TestCase): from repoze.bfg.interfaces import IExceptionViewClassifier from repoze.bfg.interfaces import IRequest req_iface = self._registerRouteRequest('foo') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=RuntimeError) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() @@ -874,7 +874,7 @@ class TestRouter(unittest.TestCase): from repoze.bfg.interfaces import IExceptionViewClassifier req_iface = self._registerRouteRequest('foo') another_req_iface = self._registerRouteRequest('bar') - self._connectRoute('archives/:action/:article', 'foo', None) + self._connectRoute('foo', 'archives/:action/:article', None) view = DummyView(DummyResponse(), raise_exception=RuntimeError) self._registerView(view, '', IViewClassifier, req_iface, None) response = DummyResponse() |
