summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2016-11-19 14:51:40 -0600
committerMichael Merickel <michael@merickel.org>2016-11-19 14:57:19 -0600
commit7b58c0f003107aba5fde6cde57f13491d5248c76 (patch)
treed5db083da53712afc5fccea76baf99777fee9982
parentd35851138f3b7d1888893efbf0ec991dcd8cf566 (diff)
downloadpyramid-7b58c0f003107aba5fde6cde57f13491d5248c76.tar.gz
pyramid-7b58c0f003107aba5fde6cde57f13491d5248c76.tar.bz2
pyramid-7b58c0f003107aba5fde6cde57f13491d5248c76.zip
update changelog for #2823
-rw-r--r--CHANGES.txt13
-rw-r--r--pyramid/config/settings.py2
-rw-r--r--pyramid/tests/test_config/test_settings.py19
3 files changed, 33 insertions, 1 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 1939ad125..a0a928f83 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -35,6 +35,10 @@ Backward Incompatibilities
encoding via ``Accept-Encoding`` request headers.
See https://github.com/Pylons/pyramid/pull/2810
+- Settings are no longer accessible as attributes on the settings object
+ (e.g. ``request.registry.settings.foo``). This was deprecated in Pyramid 1.2.
+ See https://github.com/Pylons/pyramid/pull/2823
+
Features
--------
@@ -80,6 +84,15 @@ Features
as soon as possible before importing the rest of pyramid.
See https://github.com/Pylons/pyramid/pull/2797
+- Pyramid no longer copies the settings object passed to the
+ ``pyramid.config.Configurator(settings=)``. The original ``dict`` is kept.
+ See https://github.com/Pylons/pyramid/pull/2823
+
+- The csrf trusted origins setting may now be a whitespace-separated list of
+ domains. Previously only a python list was allowed. Also, it can now be set
+ using the ``PYRAMID_CSRF_TRUSTED_ORIGINS`` environment variable similar to
+ other settings. See https://github.com/Pylons/pyramid/pull/2823
+
Bug Fixes
---------
diff --git a/pyramid/config/settings.py b/pyramid/config/settings.py
index 5684f1867..26eb48951 100644
--- a/pyramid/config/settings.py
+++ b/pyramid/config/settings.py
@@ -4,7 +4,7 @@ from pyramid.settings import asbool, aslist
class SettingsConfiguratorMixin(object):
def _set_settings(self, mapping):
- if not mapping:
+ if mapping is None:
mapping = {}
settings = Settings(mapping)
self.registry.settings = settings
diff --git a/pyramid/tests/test_config/test_settings.py b/pyramid/tests/test_config/test_settings.py
index 78198298b..2dbe9b1bb 100644
--- a/pyramid/tests/test_config/test_settings.py
+++ b/pyramid/tests/test_config/test_settings.py
@@ -11,6 +11,13 @@ class TestSettingsConfiguratorMixin(unittest.TestCase):
settings = config._set_settings(None)
self.assertTrue(settings)
+ def test__set_settings_uses_original_dict(self):
+ config = self._makeOne()
+ dummy = {}
+ result = config._set_settings(dummy)
+ self.assertTrue(dummy is result)
+ self.assertEqual(dummy['pyramid.debug_all'], False)
+
def test__set_settings_as_dictwithvalues(self):
config = self._makeOne()
settings = config._set_settings({'a':'1'})
@@ -537,6 +544,18 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['default_locale_name'], 'abc')
self.assertEqual(result['pyramid.default_locale_name'], 'abc')
+ def test_csrf_trusted_origins(self):
+ result = self._makeOne({})
+ self.assertEqual(result['pyramid.csrf_trusted_origins'], [])
+ result = self._makeOne({'pyramid.csrf_trusted_origins': 'example.com'})
+ self.assertEqual(result['pyramid.csrf_trusted_origins'], ['example.com'])
+ result = self._makeOne({'pyramid.csrf_trusted_origins': ['example.com']})
+ self.assertEqual(result['pyramid.csrf_trusted_origins'], ['example.com'])
+ result = self._makeOne({'pyramid.csrf_trusted_origins': (
+ 'example.com foo.example.com\nasdf.example.com')})
+ self.assertEqual(result['pyramid.csrf_trusted_origins'], [
+ 'example.com', 'foo.example.com', 'asdf.example.com'])
+
def test_originals_kept(self):
result = self._makeOne({'a':'i am so a'})
self.assertEqual(result['a'], 'i am so a')