diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-07-28 01:26:09 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-07-28 01:26:09 +0000 |
| commit | be6f3b9ae06b31920d90744b20ccb7a8b4d9a278 (patch) | |
| tree | 1b7b5831b1c80fb1057d0a1e73c4191825f622ab /repoze/bfg/tests | |
| parent | d58946946d3b29c3de8a7b4d937aa4af72bf63bf (diff) | |
| download | pyramid-be6f3b9ae06b31920d90744b20ccb7a8b4d9a278.tar.gz pyramid-be6f3b9ae06b31920d90744b20ccb7a8b4d9a278.tar.bz2 pyramid-be6f3b9ae06b31920d90744b20ccb7a8b4d9a278.zip | |
- When adding a view for a route which did not yet exist ("did not yet
exist" meaning, temporally, a view was added with a route name for a
route which had not yet been added via add_route), the value of the
``custom_predicate`` argument to ``add_view`` was lost. Symptom:
wrong view matches when using URL dispatch and custom view
predicates together.
Diffstat (limited to 'repoze/bfg/tests')
| -rw-r--r-- | repoze/bfg/tests/test_configuration.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_configuration.py b/repoze/bfg/tests/test_configuration.py index a4a30c7e7..b34f6c270 100644 --- a/repoze/bfg/tests/test_configuration.py +++ b/repoze/bfg/tests/test_configuration.py @@ -1219,6 +1219,17 @@ class ConfiguratorTests(unittest.TestCase): self.failIfEqual(wrapper, None) self.assertEqual(wrapper(None, None), 'OK') + def test_deferred_route_views_retains_custom_predicates(self): + view = lambda *arg: 'OK' + config = self._makeOne() + config.add_view(view=view, route_name='foo', custom_predicates=('123',)) + self.assertEqual(len(config.registry.deferred_route_views), 1) + infos = config.registry.deferred_route_views['foo'] + self.assertEqual(len(infos), 1) + info = infos[0] + self.assertEqual(info['route_name'], 'foo') + self.assertEqual(info['custom_predicates'], ('123',)) + def test_add_view_with_route_name_exception(self): from zope.interface import implementedBy from zope.component import ComponentLookupError |
