summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt7
-rw-r--r--TODO.txt2
-rw-r--r--docs/narr/environment.rst26
-rw-r--r--pyramid/settings.py24
-rw-r--r--pyramid/tests/test_settings.py44
5 files changed, 54 insertions, 49 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c1b441c50..caeaa943b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -90,6 +90,13 @@ Features
- The name ``registry`` is now available in a ``pshell`` environment by
default. It is the application registry object.
+Environment
+-----------
+
+- All environment variables which used to be prefixed with ``BFG_`` are now
+ prefixed with ``PYRAMID_`` (e.g. ``BFG_DEBUG_NOTFOUND`` is now
+ ``PYRAMID_DEBUG_NOTFOUND``)
+
Documentation
-------------
diff --git a/TODO.txt b/TODO.txt
index b5932212e..e5e825f89 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -14,8 +14,6 @@ Should-Have
- Add docs for httpexceptions module for each webob.exc class that inherits
from WSGIHTTPException.
-- Remove "BFG" from Pyramid-specific environ variables.
-
- translationdir ZCML directive use of ``path_spec`` should maybe die.
- Add CRSF token creation/checking machinery (only "should have" vs. "must
diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst
index 0c6f3dd03..4df26fbdd 100644
--- a/docs/narr/environment.rst
+++ b/docs/narr/environment.rst
@@ -46,7 +46,7 @@ template rendering extensions.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_RELOAD_TEMPLATES`` | ``reload_templates`` |
+| ``PYRAMID_RELOAD_TEMPLATES`` | ``reload_templates`` |
| | |
| | |
| | |
@@ -61,14 +61,14 @@ also :ref:`overriding_assets_section`.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_RELOAD_ASSETS`` | ``reload_assets`` |
+| ``PYRAMID_RELOAD_ASSETS`` | ``reload_assets`` |
| | |
| | |
| | |
+---------------------------------+-----------------------------+
.. note:: For backwards compatibility purposes, the following aliases can be
- used for configurating asset reloading: ``BFG_RELOAD_RESOURCES`` (envvar)
+ used for configurating asset reloading: ``PYRAMID_RELOAD_RESOURCES`` (envvar)
and ``reload_resources`` (config file).
Debugging Authorization
@@ -80,7 +80,7 @@ when this value is true. See also :ref:`debug_authorization_section`.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_DEBUG_AUTHORIZATION`` | ``debug_authorization`` |
+| ``PYRAMID_DEBUG_AUTHORIZATION`` | ``debug_authorization`` |
| | |
| | |
| | |
@@ -95,7 +95,7 @@ when this value is true. See also :ref:`debug_notfound_section`.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_DEBUG_NOTFOUND`` | ``debug_notfound`` |
+| ``PYRAMID_DEBUG_NOTFOUND`` | ``debug_notfound`` |
| | |
| | |
| | |
@@ -110,7 +110,7 @@ this value is true. See also :ref:`debug_routematch_section`.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_DEBUG_ROUTEMATCH`` | ``debug_routematch`` |
+| ``PYRAMID_DEBUG_ROUTEMATCH`` | ``debug_routematch`` |
| | |
| | |
| | |
@@ -124,7 +124,7 @@ Turns on all ``debug*`` settings.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_DEBUG_ALL`` | ``debug_all`` |
+| ``PYRAMID_DEBUG_ALL`` | ``debug_all`` |
| | |
| | |
| | |
@@ -138,7 +138,7 @@ Turns on all ``reload*`` settings.
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_RELOAD_ALL`` | ``reload_all`` |
+| ``PYRAMID_RELOAD_ALL`` | ``reload_all`` |
| | |
| | |
| | |
@@ -156,7 +156,7 @@ The value supplied here is used as the default locale name when a
+---------------------------------+-----------------------------+
| Environment Variable Name | Config File Setting Name |
+=================================+=============================+
-| ``BFG_DEFAULT_LOCALE_NAME`` | ``default_locale_name`` |
+| ``PYRAMID_DEFAULT_LOCALE_NAME`` | ``default_locale_name`` |
| | |
| | |
| | |
@@ -313,8 +313,8 @@ for settings documented as such. For example, you might start your
.. code-block:: text
- $ BFG_DEBUG_AUTHORIZATION=1 BFG_RELOAD_TEMPLATES=1 bin/paster serve \
- MyProject.ini
+ $ PYRAMID_DEBUG_AUTHORIZATION=1 PYRAMID_RELOAD_TEMPLATES=1 \
+ bin/paster serve MyProject.ini
If you started your application this way, your :app:`Pyramid`
application would behave in the same manner as if you had placed the
@@ -323,14 +323,14 @@ application's ``.ini`` file.
If you want to turn all ``debug`` settings (every setting that starts
with ``debug_``). on in one fell swoop, you can use
-``BFG_DEBUG_ALL=1`` as an environment variable setting or you may use
+``PYRAMID_DEBUG_ALL=1`` as an environment variable setting or you may use
``debug_all=true`` in the config file. Note that this does not affect
settings that do not start with ``debug_*`` such as
``reload_templates``.
If you want to turn all ``reload`` settings (every setting that starts
with ``reload_``). on in one fell swoop, you can use
-``BFG_RELOAD_ALL=1`` as an environment variable setting or you may use
+``PYRAMID_RELOAD_ALL=1`` as an environment variable setting or you may use
``reload_all=true`` in the config file. Note that this does not
affect settings that do not start with ``reload_*`` such as
``debug_notfound``.
diff --git a/pyramid/settings.py b/pyramid/settings.py
index 395694fa0..3aaf63807 100644
--- a/pyramid/settings.py
+++ b/pyramid/settings.py
@@ -10,7 +10,7 @@ from pyramid.threadlocal import get_current_registry
class Settings(dict):
""" Deployment settings. Update application settings (usually
from PasteDeploy keywords) with framework-specific key/value pairs
- (e.g. find ``BFG_DEBUG_AUTHORIZATION`` in os.environ and jam into
+ (e.g. find ``PYRAMID_DEBUG_AUTHORIZATION`` in os.environ and jam into
keyword args)."""
implements(ISettings)
# _environ_ is dep inj for testing
@@ -20,36 +20,36 @@ class Settings(dict):
dict.__init__(self, d, **kw)
eget = _environ_.get
config_debug_all = self.get('debug_all', '')
- eff_debug_all = asbool(eget('BFG_DEBUG_ALL', config_debug_all))
+ eff_debug_all = asbool(eget('PYRAMID_DEBUG_ALL', config_debug_all))
config_reload_all = self.get('reload_all', '')
- eff_reload_all = asbool(eget('BFG_RELOAD_ALL',config_reload_all))
+ eff_reload_all = asbool(eget('PYRAMID_RELOAD_ALL',config_reload_all))
config_debug_auth = self.get('debug_authorization', '')
- eff_debug_auth = asbool(eget('BFG_DEBUG_AUTHORIZATION',
+ eff_debug_auth = asbool(eget('PYRAMID_DEBUG_AUTHORIZATION',
config_debug_auth))
config_debug_notfound = self.get('debug_notfound', '')
- eff_debug_notfound = asbool(eget('BFG_DEBUG_NOTFOUND',
+ eff_debug_notfound = asbool(eget('PYRAMID_DEBUG_NOTFOUND',
config_debug_notfound))
config_debug_routematch = self.get('debug_routematch', '')
- eff_debug_routematch = asbool(eget('BFG_DEBUG_ROUTEMATCH',
+ eff_debug_routematch = asbool(eget('PYRAMID_DEBUG_ROUTEMATCH',
config_debug_routematch))
config_debug_templates = self.get('debug_templates', '')
- eff_debug_templates = asbool(eget('BFG_DEBUG_TEMPLATES',
+ eff_debug_templates = asbool(eget('PYRAMID_DEBUG_TEMPLATES',
config_debug_templates))
config_reload_templates = self.get('reload_templates', '')
- eff_reload_templates = asbool(eget('BFG_RELOAD_TEMPLATES',
+ eff_reload_templates = asbool(eget('PYRAMID_RELOAD_TEMPLATES',
config_reload_templates))
config_reload_assets = self.get('reload_assets', '')
config_reload_resources = self.get('reload_resources', '')
- reload_assets = asbool(eget('BFG_RELOAD_ASSETS',
+ reload_assets = asbool(eget('PYRAMID_RELOAD_ASSETS',
config_reload_assets))
- reload_resources = asbool(eget('BFG_RELOAD_RESOURCES',
+ reload_resources = asbool(eget('PYRAMID_RELOAD_RESOURCES',
config_reload_resources))
# reload_resources is an older alias for reload_assets
eff_reload_assets = reload_assets or reload_resources
configure_zcml = self.get('configure_zcml', '')
- eff_configure_zcml = eget('BFG_CONFIGURE_ZCML', configure_zcml)
+ eff_configure_zcml = eget('PYRAMID_CONFIGURE_ZCML', configure_zcml)
locale_name = self.get('default_locale_name', 'en')
- eff_locale_name = eget('BFG_DEFAULT_LOCALE_NAME', locale_name)
+ eff_locale_name = eget('PYRAMID_DEFAULT_LOCALE_NAME', locale_name)
update = {
'debug_authorization': eff_debug_all or eff_debug_auth,
diff --git a/pyramid/tests/test_settings.py b/pyramid/tests/test_settings.py
index 9a58280a1..9eb1cd30b 100644
--- a/pyramid/tests/test_settings.py
+++ b/pyramid/tests/test_settings.py
@@ -38,10 +38,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['reload_templates'], True)
result = self._makeOne({'reload_templates':'1'})
self.assertEqual(result['reload_templates'], True)
- result = self._makeOne({}, {'BFG_RELOAD_TEMPLATES':'1'})
+ result = self._makeOne({}, {'PYRAMID_RELOAD_TEMPLATES':'1'})
self.assertEqual(result['reload_templates'], True)
result = self._makeOne({'reload_templates':'false'},
- {'BFG_RELOAD_TEMPLATES':'1'})
+ {'PYRAMID_RELOAD_TEMPLATES':'1'})
self.assertEqual(result['reload_templates'], True)
def test_reload_resources(self):
@@ -58,11 +58,11 @@ class TestSettings(unittest.TestCase):
result = self._makeOne({'reload_resources':'1'})
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
- result = self._makeOne({}, {'BFG_RELOAD_RESOURCES':'1'})
+ result = self._makeOne({}, {'PYRAMID_RELOAD_RESOURCES':'1'})
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
result = self._makeOne({'reload_resources':'false'},
- {'BFG_RELOAD_RESOURCES':'1'})
+ {'PYRAMID_RELOAD_RESOURCES':'1'})
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
@@ -80,11 +80,11 @@ class TestSettings(unittest.TestCase):
result = self._makeOne({'reload_assets':'1'})
self.assertEqual(result['reload_assets'], True)
self.assertEqual(result['reload_resources'], True)
- result = self._makeOne({}, {'BFG_RELOAD_ASSETS':'1'})
+ result = self._makeOne({}, {'PYRAMID_RELOAD_ASSETS':'1'})
self.assertEqual(result['reload_assets'], True)
self.assertEqual(result['reload_resources'], True)
result = self._makeOne({'reload_assets':'false'},
- {'BFG_RELOAD_ASSETS':'1'})
+ {'PYRAMID_RELOAD_ASSETS':'1'})
self.assertEqual(result['reload_assets'], True)
self.assertEqual(result['reload_resources'], True)
@@ -106,12 +106,12 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['reload_templates'], True)
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
- result = self._makeOne({}, {'BFG_RELOAD_ALL':'1'})
+ result = self._makeOne({}, {'PYRAMID_RELOAD_ALL':'1'})
self.assertEqual(result['reload_templates'], True)
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
result = self._makeOne({'reload_all':'false'},
- {'BFG_RELOAD_ALL':'1'})
+ {'PYRAMID_RELOAD_ALL':'1'})
self.assertEqual(result['reload_templates'], True)
self.assertEqual(result['reload_resources'], True)
self.assertEqual(result['reload_assets'], True)
@@ -125,10 +125,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['debug_authorization'], True)
result = self._makeOne({'debug_authorization':'1'})
self.assertEqual(result['debug_authorization'], True)
- result = self._makeOne({}, {'BFG_DEBUG_AUTHORIZATION':'1'})
+ result = self._makeOne({}, {'PYRAMID_DEBUG_AUTHORIZATION':'1'})
self.assertEqual(result['debug_authorization'], True)
result = self._makeOne({'debug_authorization':'false'},
- {'BFG_DEBUG_AUTHORIZATION':'1'})
+ {'PYRAMID_DEBUG_AUTHORIZATION':'1'})
self.assertEqual(result['debug_authorization'], True)
def test_debug_notfound(self):
@@ -140,10 +140,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['debug_notfound'], True)
result = self._makeOne({'debug_notfound':'1'})
self.assertEqual(result['debug_notfound'], True)
- result = self._makeOne({}, {'BFG_DEBUG_NOTFOUND':'1'})
+ result = self._makeOne({}, {'PYRAMID_DEBUG_NOTFOUND':'1'})
self.assertEqual(result['debug_notfound'], True)
result = self._makeOne({'debug_notfound':'false'},
- {'BFG_DEBUG_NOTFOUND':'1'})
+ {'PYRAMID_DEBUG_NOTFOUND':'1'})
self.assertEqual(result['debug_notfound'], True)
def test_debug_routematch(self):
@@ -155,10 +155,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['debug_routematch'], True)
result = self._makeOne({'debug_routematch':'1'})
self.assertEqual(result['debug_routematch'], True)
- result = self._makeOne({}, {'BFG_DEBUG_ROUTEMATCH':'1'})
+ result = self._makeOne({}, {'PYRAMID_DEBUG_ROUTEMATCH':'1'})
self.assertEqual(result['debug_routematch'], True)
result = self._makeOne({'debug_routematch':'false'},
- {'BFG_DEBUG_ROUTEMATCH':'1'})
+ {'PYRAMID_DEBUG_ROUTEMATCH':'1'})
self.assertEqual(result['debug_routematch'], True)
def test_debug_templates(self):
@@ -170,10 +170,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['debug_templates'], True)
result = self._makeOne({'debug_templates':'1'})
self.assertEqual(result['debug_templates'], True)
- result = self._makeOne({}, {'BFG_DEBUG_TEMPLATES':'1'})
+ result = self._makeOne({}, {'PYRAMID_DEBUG_TEMPLATES':'1'})
self.assertEqual(result['debug_templates'], True)
result = self._makeOne({'debug_templates':'false'},
- {'BFG_DEBUG_TEMPLATES':'1'})
+ {'PYRAMID_DEBUG_TEMPLATES':'1'})
self.assertEqual(result['debug_templates'], True)
def test_debug_all(self):
@@ -197,13 +197,13 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['debug_routematch'], True)
self.assertEqual(result['debug_authorization'], True)
self.assertEqual(result['debug_templates'], True)
- result = self._makeOne({}, {'BFG_DEBUG_ALL':'1'})
+ result = self._makeOne({}, {'PYRAMID_DEBUG_ALL':'1'})
self.assertEqual(result['debug_notfound'], True)
self.assertEqual(result['debug_routematch'], True)
self.assertEqual(result['debug_authorization'], True)
self.assertEqual(result['debug_templates'], True)
result = self._makeOne({'debug_all':'false'},
- {'BFG_DEBUG_ALL':'1'})
+ {'PYRAMID_DEBUG_ALL':'1'})
self.assertEqual(result['debug_notfound'], True)
self.assertEqual(result['debug_routematch'], True)
self.assertEqual(result['debug_authorization'], True)
@@ -214,10 +214,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['configure_zcml'], '')
result = self._makeOne({'configure_zcml':'abc'})
self.assertEqual(result['configure_zcml'], 'abc')
- result = self._makeOne({}, {'BFG_CONFIGURE_ZCML':'abc'})
+ result = self._makeOne({}, {'PYRAMID_CONFIGURE_ZCML':'abc'})
self.assertEqual(result['configure_zcml'], 'abc')
result = self._makeOne({'configure_zcml':'def'},
- {'BFG_CONFIGURE_ZCML':'abc'})
+ {'PYRAMID_CONFIGURE_ZCML':'abc'})
self.assertEqual(result['configure_zcml'], 'abc')
def test_default_locale_name(self):
@@ -225,10 +225,10 @@ class TestSettings(unittest.TestCase):
self.assertEqual(result['default_locale_name'], 'en')
result = self._makeOne({'default_locale_name':'abc'})
self.assertEqual(result['default_locale_name'], 'abc')
- result = self._makeOne({}, {'BFG_DEFAULT_LOCALE_NAME':'abc'})
+ result = self._makeOne({}, {'PYRAMID_DEFAULT_LOCALE_NAME':'abc'})
self.assertEqual(result['default_locale_name'], 'abc')
result = self._makeOne({'default_locale_name':'def'},
- {'BFG_DEFAULT_LOCALE_NAME':'abc'})
+ {'PYRAMID_DEFAULT_LOCALE_NAME':'abc'})
self.assertEqual(result['default_locale_name'], 'abc')
def test_originals_kept(self):