From 4e818e9f690b7edba7bf434ac63c3c7e01bb1bd4 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Mon, 26 Jul 2010 20:16:44 +0000 Subject: return route from add_route --- repoze/bfg/configuration.py | 2 +- repoze/bfg/tests/test_configuration.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/repoze/bfg/configuration.py b/repoze/bfg/configuration.py index 124ce076a..08f6a6a5c 100644 --- a/repoze/bfg/configuration.py +++ b/repoze/bfg/configuration.py @@ -1285,7 +1285,7 @@ class Configurator(object): if mapper is None: mapper = RoutesMapper() self.registry.registerUtility(mapper, IRoutesMapper) - mapper.connect(path, name, factory, predicates=predicates) + return mapper.connect(path, name, factory, predicates=predicates) def scan(self, package=None, categories=None, _info=u''): """ Scan a Python package and any of its subpackages for diff --git a/repoze/bfg/tests/test_configuration.py b/repoze/bfg/tests/test_configuration.py index 0cb8ff5e8..a4a30c7e7 100644 --- a/repoze/bfg/tests/test_configuration.py +++ b/repoze/bfg/tests/test_configuration.py @@ -1510,8 +1510,9 @@ class ConfiguratorTests(unittest.TestCase): def test_add_route_defaults(self): config = self._makeOne() - config.add_route('name', 'path') + route = config.add_route('name', 'path') self._assertRoute(config, 'name', 'path') + self.assertEqual(route.name, 'name') def test_add_route_with_xhr(self): config = self._makeOne() -- cgit v1.2.3