summaryrefslogtreecommitdiff
path: root/repoze
diff options
context:
space:
mode:
Diffstat (limited to 'repoze')
-rw-r--r--repoze/bfg/registry.py9
-rw-r--r--repoze/bfg/tests/test_registry.py5
2 files changed, 13 insertions, 1 deletions
diff --git a/repoze/bfg/registry.py b/repoze/bfg/registry.py
index 5dda3f7a6..cab95933b 100644
--- a/repoze/bfg/registry.py
+++ b/repoze/bfg/registry.py
@@ -92,6 +92,10 @@ def asbool(s):
return s.lower() in ('t', 'true', 'y', 'yes', 'on', '1')
def get_options(kw, environ=os.environ):
+ """ Update PasteDeploy application settings keywords with
+ framework-specific key/value pairs (e.g. find
+ 'BFG_DEBUG_AUTHORIZATION' in os.environ and jam into keyword
+ args)."""
# environ is passed in for unit tests
eget = environ.get
config_debug_all = kw.get('debug_all', '')
@@ -109,13 +113,16 @@ def get_options(kw, environ=os.environ):
config_unicode_path_segments = kw.get('unicode_path_segments', '')
effective_unicode_path_segments = asbool(eget('BFG_UNICODE_PATH_SEGMENTS',
config_unicode_path_segments))
- return {
+ update = {
'debug_authorization': effective_debug_all or effective_debug_auth,
'debug_notfound': effective_debug_all or effective_debug_notfound,
'reload_templates': effective_reload_templates,
'unicode_path_segments': effective_unicode_path_segments,
}
+ kw.update(update)
+ return kw
+
from zope.testing.cleanup import addCleanUp
try:
addCleanUp(original_getSiteManager.reset)
diff --git a/repoze/bfg/tests/test_registry.py b/repoze/bfg/tests/test_registry.py
index f10fe6a52..9bf09399f 100644
--- a/repoze/bfg/tests/test_registry.py
+++ b/repoze/bfg/tests/test_registry.py
@@ -133,6 +133,11 @@ class TestGetOptions(unittest.TestCase):
{'BFG_UNICODE_PATH_SEGMENTS':'1'})
self.assertEqual(result['unicode_path_segments'], True)
+ def test_originals_kept(self):
+ get_options = self._getFUT()
+ result = get_options({'a':'i am so a'})
+ self.assertEqual(result['a'], 'i am so a')
+
class TestSettings(unittest.TestCase):
def _getTargetClass(self):
from repoze.bfg.registry import Settings