Chris McDonough
2011-08-26 2a818aa445a5ed844c30d9a5df1f89adfab728d4
- An include could not set a root factory successfully because the
Configurator constructor unconditionally registered one that would be
treated as if it were "the word of the user".
3 files modified
22 ■■■■ changed files
CHANGES.txt 4 ●●●● patch | view | raw | blame | history
pyramid/config/__init__.py 3 ●●●● patch | view | raw | blame | history
pyramid/tests/test_config/test_init.py 15 ●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -8,6 +8,10 @@
- Mako rendering exceptions had the wrong value for an error message.
- An include could not set a root factory successfully because the
  Configurator constructor unconditionally registered one that would be
  treated as if it were "the word of the user".
1.2a1 (2011-08-24)
==================
pyramid/config/__init__.py
@@ -334,7 +334,8 @@
        for name, renderer in renderers:
            self.add_renderer(name, renderer)
        self.set_root_factory(root_factory)
        if root_factory is not None:
            self.set_root_factory(root_factory)
        if locale_negotiator:
            self.set_locale_negotiator(locale_negotiator)
pyramid/tests/test_config/test_init.py
@@ -201,7 +201,15 @@
        config = self._makeOne()
        self.assertEqual(config.registry.queryUtility(IRootFactory), None)
        config.commit()
        self.assertTrue(config.registry.getUtility(IRootFactory))
        self.assertEqual(config.registry.queryUtility(IRootFactory), None)
    def test_ctor_with_root_factory(self):
        from pyramid.interfaces import IRootFactory
        factory = object()
        config = self._makeOne(root_factory=factory)
        self.assertEqual(config.registry.queryUtility(IRootFactory), None)
        config.commit()
        self.assertEqual(config.registry.queryUtility(IRootFactory), factory)
    def test_ctor_alternate_renderers(self):
        from pyramid.interfaces import IRendererFactory
@@ -512,15 +520,14 @@
        config.setup_registry(authorization_policy=policy)
        config = self.assertRaises(ConfigurationExecutionError, config.commit)
    def test_setup_registry_default_root_factory(self):
    def test_setup_registry_no_default_root_factory(self):
        from pyramid.registry import Registry
        from pyramid.interfaces import IRootFactory
        reg = Registry()
        config = self._makeOne(reg)
        config.setup_registry()
        self.assertEqual(reg.queryUtility(IRootFactory), None)
        config.commit()
        self.assertTrue(reg.getUtility(IRootFactory))
        self.assertEqual(reg.queryUtility(IRootFactory), None)
    def test_setup_registry_dottedname_root_factory(self):
        from pyramid.registry import Registry