From 4878517d4ccc5c9d36188076185535198c336371 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Sun, 2 Nov 2008 20:44:18 +0000 Subject: - Not passing the result of "get_options" as the second argument of make_app could cause attribute errors when attempting to look up settings against the ISettings object (internal). Fixed by giving the Settings objects defaults for ``debug_authorization`` and ``debug_notfound``. --- CHANGES.txt | 12 +++++++++++- repoze/bfg/registry.py | 2 ++ repoze/bfg/tests/test_registry.py | 21 +++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 665b45d3f..36f351b3a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,14 @@ -0.4.2 (11/2/2008) +Next Release + + Bug Fixes + + - Not passing the result of "get_options" as the second argument of + make_app could cause attribute errors when attempting to look up + settings against the ISettings object (internal). Fixed by giving + the Settings objects defaults for ``debug_authorization`` and + ``debug_notfound``. + + 0.4.2 (11/2/2008) Features diff --git a/repoze/bfg/registry.py b/repoze/bfg/registry.py index eccfa27e0..b76453f36 100644 --- a/repoze/bfg/registry.py +++ b/repoze/bfg/registry.py @@ -72,6 +72,8 @@ def makeRegistry(filename, package, options=None, lock=threading.Lock()): class Settings(object): implements(ISettings) reload_templates = False + debug_notfound = False + debug_authorization = False def __init__(self, options): self.__dict__.update(options) diff --git a/repoze/bfg/tests/test_registry.py b/repoze/bfg/tests/test_registry.py index 73bdc40fe..0b7eda586 100644 --- a/repoze/bfg/tests/test_registry.py +++ b/repoze/bfg/tests/test_registry.py @@ -117,6 +117,27 @@ class TestGetOptions(unittest.TestCase): self.assertEqual(result['debug_notfound'], True) self.assertEqual(result['debug_authorization'], True) +class TestSettings(unittest.TestCase): + def _getTargetClass(self): + from repoze.bfg.registry import Settings + return Settings + + def _makeOne(self, **options): + klass = self._getTargetClass() + return klass(options) + + def test_no_options(self): + settings = self._makeOne() + self.assertEqual(settings.reload_templates, False) + self.assertEqual(settings.debug_notfound, False) + self.assertEqual(settings.debug_authorization, False) + + def test_with_option(self): + settings = self._makeOne(reload_templates=True) + self.assertEqual(settings.reload_templates, True) + self.assertEqual(settings.debug_notfound, False) + self.assertEqual(settings.debug_authorization, False) + class TestThreadLocalRegistryManager(unittest.TestCase, PlacelessSetup): def setUp(self): PlacelessSetup.setUp(self) -- cgit v1.2.3