diff options
| author | Chris McDonough <chrism@plope.com> | 2011-08-14 01:19:40 -0400 |
|---|---|---|
| committer | Chris McDonough <chrism@plope.com> | 2011-08-14 01:19:40 -0400 |
| commit | b5ffe38cec2ac4bf8aa222204f32be9cca881dec (patch) | |
| tree | 9fb8b02b3fef99ed5dd8cb276a7314c45042ad2b | |
| parent | 5c52daef7004a1e43a7c2fc25613e3d92c4b6b8e (diff) | |
| download | pyramid-b5ffe38cec2ac4bf8aa222204f32be9cca881dec.tar.gz pyramid-b5ffe38cec2ac4bf8aa222204f32be9cca881dec.tar.bz2 pyramid-b5ffe38cec2ac4bf8aa222204f32be9cca881dec.zip | |
- The ``settings`` dictionary now raises a deprecation warning when you
attempt to access its values via ``__getattr__`` instead of
via ``__getitem__``.
| -rw-r--r-- | CHANGES.txt | 4 | ||||
| -rw-r--r-- | TODO.txt | 30 | ||||
| -rw-r--r-- | pyramid/settings.py | 12 | ||||
| -rw-r--r-- | pyramid/tests/test_settings.py | 8 |
4 files changed, 35 insertions, 19 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 19d586ac9..3432f3954 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -81,6 +81,10 @@ Deprecations them may print a deprecation warning. All scaffolds and tutorials have been changed to use prefixed settings. +- The ``settings`` dictionary now raises a deprecation warning when you + attempt to access its values via ``__getattr__`` instead of + via ``__getitem__``. + Backwards Incompatibilities --------------------------- @@ -4,15 +4,18 @@ Pyramid TODOs Should-Have ----------- -- Debugging setting for detecting why authenticated_userid(request) might - return None. - - Make it possible to use tween aliases in explicit tween config? If not, the tween factories of all add-ons must be APIs. +- Provide a way to set the authentication policy and the authorization policy + during a config.include (they are related, so just exposing the currently + underscored-private _set_auth* methods won't cut it). + - Come up with an analogue of repoze.zodbconn that doesn't require a closer in the pipeline and use it in the ZODB scaffold and tutorial. +- Merge Michael's route group work. + - Deprecate pyramid.security.view_execution_permitted (it only works for traversal). @@ -25,27 +28,22 @@ Should-Have - "static_path" API (omit host and port). -- Provide a way to set the authentication policy and the authorization policy - during a config.include (they are related, so just exposing the currently - underscored-private _set_auth* methods won't cut it). - -- Try to figure out a way to keep "settings" as the original dictionary - passed to the Configurator instead of copying it. - -- Merge Michael's route group work. - - Kill off ``bfg.routes`` envvars in router. -- Alias the stupid long default session factory name. +- Debugging setting for detecting why authenticated_userid(request) might + return None. -- Fix indirect circular import between router and config. + +Nice-to-Have +------------ - Eliminate non-deployment-non-scaffold-related Paste dependencies: ``paste.urlparser.StaticURLParser``, ``paste.auth.auth_tkt`` (cutnpaste or reimplement both). -Nice-to-Have ------------- +- Alias the stupid long default session factory name. + +- Fix indirect circular import between router and config. - Add narrative docs for wsgiapp and wsgiapp2. diff --git a/pyramid/settings.py b/pyramid/settings.py index 677ea15f3..c77a1797f 100644 --- a/pyramid/settings.py +++ b/pyramid/settings.py @@ -1,12 +1,12 @@ import os from zope.deprecation import deprecated +from zope.deprecation import deprecate from zope.interface import implements from pyramid.interfaces import ISettings from pyramid.threadlocal import get_current_registry -from pyramid.util import DottedNameResolver class Settings(dict): """ Deployment settings. Update application settings (usually @@ -95,9 +95,15 @@ class Settings(dict): } self.update(update) - + + dictlike = ('Use of the request as a dict-like object is deprecated as ' + 'of Pyramid 1.1. Use dict-like methods of "request.environ" ' + 'instead.') + + @deprecate('Obtaining settings via attributes of the settings dictionary ' + 'is deprecated as of Pyramid 1.2; use settings["foo"] instead ' + 'of settings.foo') def __getattr__(self, name): - # backwards compatibility try: return self[name] except KeyError: diff --git a/pyramid/tests/test_settings.py b/pyramid/tests/test_settings.py index 36c628f31..a85203d4e 100644 --- a/pyramid/tests/test_settings.py +++ b/pyramid/tests/test_settings.py @@ -2,6 +2,14 @@ import unittest from pyramid import testing class TestSettings(unittest.TestCase): + def setUp(self): + from zope.deprecation import __show__ + __show__.off() + + def tearDown(self): + from zope.deprecation import __show__ + __show__.on() + def _getTargetClass(self): from pyramid.settings import Settings return Settings |
