Chris McDonough
2012-09-09 ef2e51792e4f2b970d23186dd883ad4fbf7d0815
- The ``pyramid.settings.get_settings()`` API was removed.  It had been
printing a deprecation warning since Pyramid 1.0. If your code depended on
this API, use ``pyramid.threadlocal.get_current_registry().settings``
instead or use the ``settings`` attribute of the registry available from
the request (``request.registry.settings``).
5 files modified
62 ■■■■■ changed files
CHANGES.txt 6 ●●●●● patch | view | raw | blame | history
TODO.txt 2 ●●●●● patch | view | raw | blame | history
docs/api/settings.rst 2 ●●●●● patch | view | raw | blame | history
pyramid/settings.py 26 ●●●●● patch | view | raw | blame | history
pyramid/tests/test_settings.py 26 ●●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -192,6 +192,12 @@
  depended on this, adjust your code to import
  ``pyramid.scaffolds.PyramidTemplate`` instead.
- The ``pyramid.settings.get_settings()`` API was removed.  It had been
  printing a deprecation warning since Pyramid 1.0.  If your code depended on
  this API, use ``pyramid.threadlocal.get_current_registry().settings``
  instead or use the ``settings`` attribute of the registry available from
  the request (``request.registry.settings``).
Dependencies
------------
TODO.txt
@@ -98,8 +98,6 @@
Future
------
- 1.4: Remove ``pyramid.paster.PyramidTemplate`` (deprecated).
- 1.4: Remove ``pyramid.settings.get_settings`` (deprecated).
- 1.5: Remove all deprecated ``pyramid.testing`` functions.
docs/api/settings.rst
@@ -5,8 +5,6 @@
.. automodule:: pyramid.settings
  .. autofunction:: get_settings
  .. autofunction:: asbool
  .. autofunction:: aslist
pyramid/settings.py
@@ -1,30 +1,4 @@
from zope.deprecation import deprecated
from pyramid.threadlocal import get_current_registry
from pyramid.compat import string_types
def get_settings():
    """
    Return a :term:`deployment settings` object for the current application.
    The object is a dictionary-like object that contains key/value pairs
    based on the dictionary passed as the ``settings`` argument to the
    :class:`pyramid.config.Configurator` constructor or the
    :func:`pyramid.router.make_app` API.
    .. warning:: This method is deprecated as of Pyramid 1.0.  Use
       ``pyramid.threadlocal.get_current_registry().settings`` instead or use
       the ``settings`` attribute of the registry available from the request
       (``request.registry.settings``).
    """
    reg = get_current_registry()
    return reg.settings
deprecated(
    'get_settings',
    '(pyramid.settings.get_settings is deprecated as of Pyramid 1.0.  Use'
    '``pyramid.threadlocal.get_current_registry().settings`` instead or use '
    'the ``settings`` attribute of the registry available from the request '
    '(``request.registry.settings``)).')
truthy = frozenset(('t', 'true', 'y', 'yes', 'on', '1'))
pyramid/tests/test_settings.py
@@ -1,30 +1,4 @@
import unittest
from pyramid import testing
class TestGetSettings(unittest.TestCase):
    def setUp(self):
        from pyramid.registry import Registry
        registry = Registry('testing')
        self.config = testing.setUp(registry=registry)
        from zope.deprecation import __show__
        __show__.off()
    def tearDown(self):
        self.config.end()
        from zope.deprecation import __show__
        __show__.on()
    def _callFUT(self):
        from pyramid.settings import get_settings
        return get_settings()
    def test_it_nosettings(self):
        self.assertEqual(self._callFUT()['reload_templates'], False)
    def test_it_withsettings(self):
        settings = {'a':1}
        self.config.registry.settings = settings
        self.assertEqual(self._callFUT(), settings)
class Test_asbool(unittest.TestCase):
    def _callFUT(self, s):