diff options
| author | Chris McDonough <chrism@agendaless.com> | 2010-02-04 13:02:41 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2010-02-04 13:02:41 +0000 |
| commit | 98e0d06a77fef4cec0266510f2d02975ce56c405 (patch) | |
| tree | 3e59622fe467bc2ac4019c95c956f8ed43ce892c /repoze/bfg/tests/test_configuration.py | |
| parent | cb968d991b5466286aa3d53af20d405c3c48a17c (diff) | |
| download | pyramid-98e0d06a77fef4cec0266510f2d02975ce56c405.tar.gz pyramid-98e0d06a77fef4cec0266510f2d02975ce56c405.tar.bz2 pyramid-98e0d06a77fef4cec0266510f2d02975ce56c405.zip | |
- 1.2b4 introduced a bug whereby views added via a route configuration
that named a view callable and also a ``view_attr`` became broken.
Symptom: ``MyViewClass is not callable`` or the ``__call__`` of a
class was being called instead of the method named via
``view_attr``.
Diffstat (limited to 'repoze/bfg/tests/test_configuration.py')
| -rw-r--r-- | repoze/bfg/tests/test_configuration.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/repoze/bfg/tests/test_configuration.py b/repoze/bfg/tests/test_configuration.py index 78e1949e4..90413f1d6 100644 --- a/repoze/bfg/tests/test_configuration.py +++ b/repoze/bfg/tests/test_configuration.py @@ -1197,6 +1197,20 @@ class ConfiguratorTests(unittest.TestCase): self._assertRoute(config, 'name', 'path') self.assertEqual(wrapper(None, None).body, 'Hello!') + def test_add_route_with_view_attr(self): + config = self._makeOne() + self._registerRenderer(config) + class View(object): + def __init__(self, context, request): + pass + def alt(self): + return 'OK' + config.add_route('name', 'path', view=View, view_attr='alt') + request_type = self._getRouteRequestIface(config, 'name') + wrapper = self._getViewCallable(config, None, request_type) + self._assertRoute(config, 'name', 'path') + self.assertEqual(wrapper(None, None), 'OK') + def test_add_route_with_view_renderer_alias(self): config = self._makeOne() self._registerRenderer(config) |
