From 6daa9d31d98000d8cc87451cdf288624148659f9 Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Fri, 31 Aug 2012 21:46:45 +0400 Subject: Let submappers' children have their own controllers. --- routes/mapper.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routes/mapper.py b/routes/mapper.py index bfcea4a..ecabe89 100644 --- a/routes/mapper.py +++ b/routes/mapper.py @@ -160,6 +160,8 @@ class SubMapper(SubMapperParent): elif key in kwargs: if isinstance(value, dict): newkargs[key] = dict(value, **kwargs[key]) # merge dicts + elif key == 'controller': + newkargs[key] = kwargs[key] else: newkargs[key] = value + kwargs[key] else: -- cgit v1.2.1 From b36017431dab2f9ca9f1960f006bf8d1c2c3cb4c Mon Sep 17 00:00:00 2001 From: Yuriy Taraday Date: Mon, 18 Nov 2013 15:02:34 +0400 Subject: Add tests for submappers' controllers fix --- tests/test_functional/test_submapper.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_functional/test_submapper.py b/tests/test_functional/test_submapper.py index 2efcd94..1df97a6 100644 --- a/tests/test_functional/test_submapper.py +++ b/tests/test_functional/test_submapper.py @@ -142,6 +142,18 @@ class TestSubmapper(unittest.TestCase): eq_(True, r.conditions['sub_domain']) eq_(requirement, r.reqs) + def test_subsubmapper_with_controller(self): + m = Mapper() + col1 = m.collection('parents', 'parent', + controller='col1', + member_prefix='/{parent_id}') + # NOTE: If one uses functions as controllers, the error will be here. + col2 = col1.member.collection('children', 'child', + controller='col2', + member_prefix='/{child_id}') + match = m.match('/parents/1/children/2') + eq_('col2', match.get('controller')) + if __name__ == '__main__': unittest.main() -- cgit v1.2.1