summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2008-11-02 20:44:18 +0000
committerChris McDonough <chrism@agendaless.com>2008-11-02 20:44:18 +0000
commit4878517d4ccc5c9d36188076185535198c336371 (patch)
tree40ad9b962df110ddd70a6a4def4d4b6cec2e76f3
parent6b33335a356615efa43b76d812082f0534e89e60 (diff)
downloadpyramid-4878517d4ccc5c9d36188076185535198c336371.tar.gz
pyramid-4878517d4ccc5c9d36188076185535198c336371.tar.bz2
pyramid-4878517d4ccc5c9d36188076185535198c336371.zip
- 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``.
-rw-r--r--CHANGES.txt12
-rw-r--r--repoze/bfg/registry.py2
-rw-r--r--repoze/bfg/tests/test_registry.py21
3 files changed, 34 insertions, 1 deletions
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)