CHANGES.txt | ●●●●● patch | view | raw | blame | history | |
pyramid/config/settings.py | ●●●●● patch | view | raw | blame | history | |
pyramid/tests/test_config/test_settings.py | ●●●●● patch | view | raw | blame | history |
CHANGES.txt
@@ -35,6 +35,10 @@ 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 @@ 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 --------- pyramid/config/settings.py
@@ -4,7 +4,7 @@ class SettingsConfiguratorMixin(object): def _set_settings(self, mapping): if not mapping: if mapping is None: mapping = {} settings = Settings(mapping) self.registry.settings = settings pyramid/tests/test_config/test_settings.py
@@ -11,6 +11,13 @@ 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 @@ 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')