summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt8
-rw-r--r--docs/narr/MyProject/development.ini2
-rw-r--r--docs/narr/environment.rst201
-rw-r--r--docs/narr/hooks.rst16
-rw-r--r--docs/narr/project.rst12
-rw-r--r--docs/tutorials/wiki/src/authorization/development.ini4
-rw-r--r--docs/tutorials/wiki/src/authorization/production.ini2
-rw-r--r--docs/tutorials/wiki/src/basiclayout/development.ini4
-rw-r--r--docs/tutorials/wiki/src/basiclayout/production.ini2
-rw-r--r--docs/tutorials/wiki/src/models/development.ini4
-rw-r--r--docs/tutorials/wiki/src/models/production.ini2
-rw-r--r--docs/tutorials/wiki/src/tests/development.ini4
-rw-r--r--docs/tutorials/wiki/src/tests/production.ini2
-rw-r--r--docs/tutorials/wiki/src/views/development.ini4
-rw-r--r--docs/tutorials/wiki/src/views/production.ini2
-rw-r--r--docs/tutorials/wiki2/src/authorization/development.ini9
-rw-r--r--docs/tutorials/wiki2/src/authorization/production.ini6
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/development.ini9
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/production.ini7
-rw-r--r--docs/tutorials/wiki2/src/models/development.ini9
-rw-r--r--docs/tutorials/wiki2/src/models/production.ini7
-rw-r--r--docs/tutorials/wiki2/src/tests/development.ini9
-rw-r--r--docs/tutorials/wiki2/src/tests/production.ini7
-rw-r--r--docs/tutorials/wiki2/src/views/development.ini9
-rw-r--r--docs/tutorials/wiki2/src/views/production.ini7
-rw-r--r--pyramid/config.py7
-rw-r--r--pyramid/scaffolds/alchemy/development.ini_tmpl4
-rw-r--r--pyramid/scaffolds/routesalchemy/development.ini_tmpl4
-rw-r--r--pyramid/scaffolds/routesalchemy/production.ini_tmpl2
-rw-r--r--pyramid/scaffolds/starter/development.ini_tmpl2
-rw-r--r--pyramid/scaffolds/zodb/development.ini_tmpl4
-rw-r--r--pyramid/scaffolds/zodb/production.ini_tmpl2
-rw-r--r--pyramid/settings.py13
-rw-r--r--pyramid/tests/test_config.py13
-rw-r--r--pyramid/tests/test_settings.py38
35 files changed, 336 insertions, 101 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index c64582e02..65dcf11fa 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -4,6 +4,10 @@ Next release
Features
--------
+- A new configuration setting named ``pyramid.includes`` is now available.
+ It is described in the "Environment Variables and ``.ini`` Files Settings"
+ narrative documentation chapter.
+
- Added a ``route_prefix`` argument to the
``pyramid.config.Configurator.include`` method. This argument allows you
to compose URL dispatch applications together. See the section entitled
@@ -90,6 +94,10 @@ Documentation
- Added a "Displaying Tweens" section to the "Command-Line Pyramid" narrative
chapter.
+- Added documentation for the ``pyramid.tweens`` and ``pyramid.includes``
+ configuration settings to the "Environment Variables and ``.ini`` Files
+ Settings" chapter.
+
Bug Fixes
---------
diff --git a/docs/narr/MyProject/development.ini b/docs/narr/MyProject/development.ini
index 1818e387b..e134e9f06 100644
--- a/docs/narr/MyProject/development.ini
+++ b/docs/narr/MyProject/development.ini
@@ -7,7 +7,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
+pyramid.includes = pyramid_debugtoolbar
[pipeline:main]
pipeline =
diff --git a/docs/narr/environment.rst b/docs/narr/environment.rst
index 6465c2a1e..2f5555840 100644
--- a/docs/narr/environment.rst
+++ b/docs/narr/environment.rst
@@ -185,6 +185,191 @@ The value supplied here is used as the default locale name when a
| | |
+---------------------------------+-----------------------------------+
+Including Packages
+------------------
+
+``pyramid.includes`` instructs your application to include other packages.
+Using the setting is equivalent to using the
+:meth:`pyramid.config.Configurator.include` method.
+
++---------------------------------+
+| Config File Setting Name |
++=================================+
+| ``pyramid.includes`` |
+| |
+| |
+| |
++---------------------------------+
+
+The value supplied as ``pyramid.includes`` should be a sequence. The
+sequence can take several different forms.
+
+1) It can be a string.
+
+ If it is a string, the package names can be separated by spaces::
+
+ package1 package2 package3
+
+ The package names can also be separated by carriage returns::
+
+ package1
+ package2
+ package3
+
+2) It can be a Python list, where the values are strings::
+
+ ['package1', 'package2', 'package3']
+
+Each value in the sequence should be a :term:`dotted Python name`.
+
+``pyramid.includes`` vs. :meth:`pyramid.config.Configurator.include`
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Two methods exist for including packages: ``pyramid.includes`` and
+:meth:`pyramid.config.Configurator.include`. This section explains their
+equivalence.
+
+Using PasteDeploy
++++++++++++++++++
+
+Using the following ``pyramid.includes`` setting in the PasteDeploy ``.ini``
+file in your application:
+
+.. code-block:: ini
+
+ [app:myapp]
+ pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
+Is equivalent to using the following statements in your configuration code:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+
+ def main(global_config, **settings):
+ config = Configurator(settings=settings)
+ # ...
+ config.include('pyramid_debugtoolbar')
+ config.include('pyramid_tm')
+ # ...
+
+It is fine to use both or either form.
+
+Plain Python
+++++++++++++
+
+Using the following ``pyramid.includes`` setting in your plain-Python Pyramid
+application:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+
+ if __name__ == '__main__':
+ settings = {'pyramid.includes':'pyramid_debugtoolbar pyramid_tm'}
+ config = Configurator(settings=settings)
+
+Is equivalent to using the following statements in your configuration code:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+
+ if __name__ == '__main__':
+ settings = {}
+ config = Configurator(settings=settings)
+ config.include('pyramid_debugtoolbar')
+ config.include('pyramid_tm')
+
+It is fine to use both or either form.
+
+Explicit Tween Configuration
+----------------------------
+
+This value allows you to perform explicit :term:`tween` ordering in your
+configuration. Tweens are bits of code used by add-on authors to extend
+Pyramid. They form a chain, and require ordering.
+
+Ideally, you won't need to use the ``pyramid.tweens`` setting at all. Tweens
+are generally ordered and included "implicitly" when an add-on package which
+registers a tween is "included". Packages are included when you name a
+``pyramid.includes`` setting in your configuration or when you call
+:meth:`pyramid.config.Configuration.include`.
+
+Authors of included add-ons provide "implicit" tween configuration ordering
+hints to Pyramid when their packages are included. However, the implicit
+tween ordering is only best-effort. Pyramid will attempt to provide an
+implicit order of tweens as best it can using hints provided by add-on
+authors, but because it's only best-effort, if very precise tween ordering is
+required, the only surefire way to get it is to use an explicit tween order.
+You may be required to inspect your tween ordering (see
+:ref:`displaying_tweens`) and add a ``pyramid.tweens`` configuration value at
+the behest of an add-on author.
+
++---------------------------------+
+| Config File Setting Name |
++=================================+
+| ``pyramid.tweens`` |
+| |
+| |
+| |
++---------------------------------+
+
+The value supplied as ``pyramid.tweens`` should be a sequence. The
+sequence can take several different forms.
+
+1) It can be a string.
+
+ If it is a string, the tween names can be separated by spaces::
+
+ pkg.tween_factory1 pkg.tween_factory2 pkg.tween_factory3
+
+ The tween names can also be separated by carriage returns::
+
+ pkg.tween_factory1
+ pkg.tween_factory2
+ pkg.tween_factory3
+
+2) It can be a Python list, where the values are strings::
+
+ ['pkg.tween_factory1', 'pkg.tween_factory2', 'pkg.tween_factory3']
+
+Each value in the sequence should be a :term:`dotted Python name`.
+
+Paste Configuration vs. Plain-Python Configuration
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Using the following ``pyramid.tweens`` setting in the PasteDeploy ``.ini``
+file in your application:
+
+.. code-block:: ini
+
+ [app:myapp]
+ pyramid.tweens = pyramid_debugtoolbar.toolbar.tween_factory
+ pyramid.tweens.excview_tween_factory
+ pyramid_tm.tm_tween_factory
+
+Is equivalent to using the following statements in your configuration code:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.config import Configurator
+
+ def main(global_config, **settings):
+ settings['pyramid.tweens'] = [
+ 'pyramid_debugtoolbar.toolbar.tween_factory',
+ 'pyramid.tweebs.excview_tween_factory',
+ 'pyramid_tm.tm_tween_factory',
+ ]
+ config = Configurator(settings=settings)
+
+It is fine to use both or either form.
+
.. _mako_template_renderer_settings:
Mako Template Render Settings
@@ -198,7 +383,7 @@ Renderer uses a subclass of Mako's `template lookup
several arguments to configure it.
Mako Directories
-++++++++++++++++
+~~~~~~~~~~~~~~~~
The value(s) supplied here are passed in as the template directories. They
should be in :term:`asset specification` format, for example:
@@ -214,7 +399,7 @@ should be in :term:`asset specification` format, for example:
+-----------------------------+
Mako Module Directory
-+++++++++++++++++++++
+~~~~~~~~~~~~~~~~~~~~~
The value supplied here tells Mako where to store compiled Mako templates. If
omitted, compiled templates will be stored in memory. This value should be an
@@ -231,7 +416,7 @@ called ``data/templates`` in the same parent directory as the INI file.
+-----------------------------+
Mako Input Encoding
-+++++++++++++++++++
+~~~~~~~~~~~~~~~~~~~
The encoding that Mako templates are assumed to have. By default this is set
to ``utf-8``. If you wish to use a different template encoding, this value
@@ -247,7 +432,7 @@ should be changed accordingly.
+-----------------------------+
Mako Error Handler
-++++++++++++++++++
+~~~~~~~~~~~~~~~~~~
A callable (or a :term:`dotted Python name` which names a callable) which is
called whenever Mako compile or runtime exceptions occur. The callable is
@@ -265,7 +450,7 @@ the function completes. Is used to provide custom error-rendering functions.
+-----------------------------+
Mako Default Filters
-++++++++++++++++++++
+~~~~~~~~~~~~~~~~~~~~
List of string filter names that will be applied to all Mako expressions.
@@ -279,7 +464,7 @@ List of string filter names that will be applied to all Mako expressions.
+-----------------------------+
Mako Import
-+++++++++++
+~~~~~~~~~~~
String list of Python statements, typically individual "import" lines, which
will be placed into the module level preamble of all generated Python modules.
@@ -296,7 +481,7 @@ will be placed into the module level preamble of all generated Python modules.
Mako Strict Undefined
-+++++++++++++++++++++
+~~~~~~~~~~~~~~~~~~~~~
``true`` or ``false``, representing the "strict undefined" behavior of Mako
(see `Mako Context Variables
@@ -313,7 +498,7 @@ default, this is ``false``.
+-----------------------------+
Mako Preprocessor
-+++++++++++++++++
+~~~~~~~~~~~~~~~~~
A callable (or a :term:`dotted Python name` which names a callable) which is
called to preprocess the source before the template is called. The callable
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index fafb407d3..c8efc057c 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -931,8 +931,9 @@ entirely by the relative ordering of calls to
add_tween can provide an optional hint that can influence the implicit tween
chain ordering by supplying ``under`` or ``over`` (or both) arguments to
:meth:`~pyramid.config.Configurator.add_tween`. These hints are only used
-used when an explicit tween chain is not used (when the ``pyramid.tweens``
-configuration value is not set).
+used when an explicit tween ordering is not used. See
+:ref:`explicit_tween_ordering` for a description of how to set an explicit
+tween ordering.
Allowable values for ``under`` or ``over`` (or both) are:
@@ -1034,6 +1035,11 @@ For example:
Alias names are only useful in relation to ``under`` and ``over`` values.
They cannot be used in explicit tween chain configuration, or anywhere else.
+.. _explicit_tween_ordering:
+
+Explicit Tween Ordering
+~~~~~~~~~~~~~~~~~~~~~~~
+
Implicit tween ordering is obviously only best-effort. Pyramid will attempt
to provide an implicit order of tweens as best it can using hints provided by
calls to :meth:`~pyramid.config.Configurator.add_tween`, but because it's
@@ -1077,6 +1083,9 @@ handler is implicit, and always "at the bottom".
``pyramid.tweens`` configuration setting list explicitly. If it is not
present, Pyramid will not perform exception view handling.
+Tween Conflicts and Ordering Cycles
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
Pyramid will prevent the same tween factory from being added to the tween
chain more than once using configuration conflict detection. If you wish to
add the same tween factory more than once in a configuration, you should
@@ -1090,6 +1099,9 @@ If a cycle is detected in implicit tween ordering when ``over`` and ``under``
are used in any call to "add_tween", an exception will be raised at startup
time.
+Displaying Tween Ordering
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
The ``paster ptweens`` command-line utility can be used to report the current
implict and explicit tween chains used by an application. See
:ref:`displaying_tweens`.
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index baf4c86fa..e59d04ee1 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -327,7 +327,7 @@ when you use the ``production.ini`` file instead of the ``development.ini``
ini file to run the application.
You can also turn the debug toolbar off by editing ``development.ini`` and
-commenting out the line ``pyramid.include = pyramid_debugtoolbar``. For
+commenting out the line ``pyramid.includes = pyramid_debugtoolbar``. For
example, instead of:
.. code-block:: ini
@@ -335,16 +335,16 @@ example, instead of:
[app:MyApp]
...
- pyramid.include = pyramid_debugtoolbar
+ pyramid.includes = pyramid_debugtoolbar
-Put a hash mark in front of the ``pyramid.include`` line:
+Put a hash mark in front of the ``pyramid.includes`` line:
.. code-block:: ini
:linenos:
[app:MyApp]
...
- #pyramid.include = pyramid_debugtoolbar
+ #pyramid.includes = pyramid_debugtoolbar
Then restart the application to see that the toolbar has been turned off.
@@ -526,9 +526,9 @@ information.
options should be turned off for production applications, as template
rendering is slowed when either is turned on.
-The ``pyramid.include`` setting in the ``[app:MyProject]`` section tells
+The ``pyramid.includes`` setting in the ``[app:MyProject]`` section tells
Pyramid to "include" configuration from another package. In this case, the
-line ``pyramid.include = pyramid_debugtoolbar`` tells Pyramid to include
+line ``pyramid.includes = pyramid_debugtoolbar`` tells Pyramid to include
configuration from the ``pyramid_debugtoolbar`` package. This turns on a
debugging panel in development mode which will be shown on the right hand
side of the screen. Including the debug toolbar will also make it possible
diff --git a/docs/tutorials/wiki/src/authorization/development.ini b/docs/tutorials/wiki/src/authorization/development.ini
index 733046ed8..48a093981 100644
--- a/docs/tutorials/wiki/src/authorization/development.ini
+++ b/docs/tutorials/wiki/src/authorization/development.ini
@@ -6,8 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/authorization/production.ini b/docs/tutorials/wiki/src/authorization/production.ini
index 077620293..bd8199fb2 100644
--- a/docs/tutorials/wiki/src/authorization/production.ini
+++ b/docs/tutorials/wiki/src/authorization/production.ini
@@ -6,7 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/basiclayout/development.ini b/docs/tutorials/wiki/src/basiclayout/development.ini
index edbdd169e..4759662ff 100644
--- a/docs/tutorials/wiki/src/basiclayout/development.ini
+++ b/docs/tutorials/wiki/src/basiclayout/development.ini
@@ -6,8 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/basiclayout/production.ini b/docs/tutorials/wiki/src/basiclayout/production.ini
index 077620293..bd8199fb2 100644
--- a/docs/tutorials/wiki/src/basiclayout/production.ini
+++ b/docs/tutorials/wiki/src/basiclayout/production.ini
@@ -6,7 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/models/development.ini b/docs/tutorials/wiki/src/models/development.ini
index 733046ed8..48a093981 100644
--- a/docs/tutorials/wiki/src/models/development.ini
+++ b/docs/tutorials/wiki/src/models/development.ini
@@ -6,8 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/models/production.ini b/docs/tutorials/wiki/src/models/production.ini
index 077620293..bd8199fb2 100644
--- a/docs/tutorials/wiki/src/models/production.ini
+++ b/docs/tutorials/wiki/src/models/production.ini
@@ -6,7 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/tests/development.ini b/docs/tutorials/wiki/src/tests/development.ini
index 733046ed8..48a093981 100644
--- a/docs/tutorials/wiki/src/tests/development.ini
+++ b/docs/tutorials/wiki/src/tests/development.ini
@@ -6,8 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/tests/production.ini b/docs/tutorials/wiki/src/tests/production.ini
index 077620293..bd8199fb2 100644
--- a/docs/tutorials/wiki/src/tests/production.ini
+++ b/docs/tutorials/wiki/src/tests/production.ini
@@ -6,7 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/views/development.ini b/docs/tutorials/wiki/src/views/development.ini
index edbdd169e..4759662ff 100644
--- a/docs/tutorials/wiki/src/views/development.ini
+++ b/docs/tutorials/wiki/src/views/development.ini
@@ -6,8 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki/src/views/production.ini b/docs/tutorials/wiki/src/views/production.ini
index 077620293..bd8199fb2 100644
--- a/docs/tutorials/wiki/src/views/production.ini
+++ b/docs/tutorials/wiki/src/views/production.ini
@@ -6,7 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/docs/tutorials/wiki2/src/authorization/development.ini b/docs/tutorials/wiki2/src/authorization/development.ini
index bd71cdba5..f93a88e6b 100644
--- a/docs/tutorials/wiki2/src/authorization/development.ini
+++ b/docs/tutorials/wiki2/src/authorization/development.ini
@@ -6,18 +6,15 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[pipeline:main]
pipeline =
- egg:WebError#evalerror
- tm
tutorial
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
diff --git a/docs/tutorials/wiki2/src/authorization/production.ini b/docs/tutorials/wiki2/src/authorization/production.ini
index ed8eadacc..f7b742cb9 100644
--- a/docs/tutorials/wiki2/src/authorization/production.ini
+++ b/docs/tutorials/wiki2/src/authorization/production.ini
@@ -6,6 +6,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[filter:weberror]
@@ -22,14 +23,9 @@ debug = false
;smtp_use_tls =
;error_message =
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[pipeline:main]
pipeline =
weberror
- tm
tutorial
[server:main]
diff --git a/docs/tutorials/wiki2/src/basiclayout/development.ini b/docs/tutorials/wiki2/src/basiclayout/development.ini
index bd71cdba5..f93a88e6b 100644
--- a/docs/tutorials/wiki2/src/basiclayout/development.ini
+++ b/docs/tutorials/wiki2/src/basiclayout/development.ini
@@ -6,18 +6,15 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[pipeline:main]
pipeline =
- egg:WebError#evalerror
- tm
tutorial
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
diff --git a/docs/tutorials/wiki2/src/basiclayout/production.ini b/docs/tutorials/wiki2/src/basiclayout/production.ini
index ed8eadacc..c80a0a216 100644
--- a/docs/tutorials/wiki2/src/basiclayout/production.ini
+++ b/docs/tutorials/wiki2/src/basiclayout/production.ini
@@ -6,6 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[filter:weberror]
@@ -22,14 +24,9 @@ debug = false
;smtp_use_tls =
;error_message =
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[pipeline:main]
pipeline =
weberror
- tm
tutorial
[server:main]
diff --git a/docs/tutorials/wiki2/src/models/development.ini b/docs/tutorials/wiki2/src/models/development.ini
index bd71cdba5..f93a88e6b 100644
--- a/docs/tutorials/wiki2/src/models/development.ini
+++ b/docs/tutorials/wiki2/src/models/development.ini
@@ -6,18 +6,15 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[pipeline:main]
pipeline =
- egg:WebError#evalerror
- tm
tutorial
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
diff --git a/docs/tutorials/wiki2/src/models/production.ini b/docs/tutorials/wiki2/src/models/production.ini
index ed8eadacc..c80a0a216 100644
--- a/docs/tutorials/wiki2/src/models/production.ini
+++ b/docs/tutorials/wiki2/src/models/production.ini
@@ -6,6 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[filter:weberror]
@@ -22,14 +24,9 @@ debug = false
;smtp_use_tls =
;error_message =
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[pipeline:main]
pipeline =
weberror
- tm
tutorial
[server:main]
diff --git a/docs/tutorials/wiki2/src/tests/development.ini b/docs/tutorials/wiki2/src/tests/development.ini
index bd71cdba5..f93a88e6b 100644
--- a/docs/tutorials/wiki2/src/tests/development.ini
+++ b/docs/tutorials/wiki2/src/tests/development.ini
@@ -6,18 +6,15 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[pipeline:main]
pipeline =
- egg:WebError#evalerror
- tm
tutorial
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
diff --git a/docs/tutorials/wiki2/src/tests/production.ini b/docs/tutorials/wiki2/src/tests/production.ini
index ed8eadacc..c80a0a216 100644
--- a/docs/tutorials/wiki2/src/tests/production.ini
+++ b/docs/tutorials/wiki2/src/tests/production.ini
@@ -6,6 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[filter:weberror]
@@ -22,14 +24,9 @@ debug = false
;smtp_use_tls =
;error_message =
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[pipeline:main]
pipeline =
weberror
- tm
tutorial
[server:main]
diff --git a/docs/tutorials/wiki2/src/views/development.ini b/docs/tutorials/wiki2/src/views/development.ini
index bd71cdba5..f93a88e6b 100644
--- a/docs/tutorials/wiki2/src/views/development.ini
+++ b/docs/tutorials/wiki2/src/views/development.ini
@@ -6,18 +6,15 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[pipeline:main]
pipeline =
- egg:WebError#evalerror
- tm
tutorial
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
diff --git a/docs/tutorials/wiki2/src/views/production.ini b/docs/tutorials/wiki2/src/views/production.ini
index ed8eadacc..c80a0a216 100644
--- a/docs/tutorials/wiki2/src/views/production.ini
+++ b/docs/tutorials/wiki2/src/views/production.ini
@@ -6,6 +6,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
+pyramid.includes = pyramid_tm
+
sqlalchemy.url = sqlite:///%(here)s/tutorial.db
[filter:weberror]
@@ -22,14 +24,9 @@ debug = false
;smtp_use_tls =
;error_message =
-[filter:tm]
-use = egg:repoze.tm2#tm
-commit_veto = repoze.tm:default_commit_veto
-
[pipeline:main]
pipeline =
weberror
- tm
tutorial
[server:main]
diff --git a/pyramid/config.py b/pyramid/config.py
index 4fbcd2819..920b70319 100644
--- a/pyramid/config.py
+++ b/pyramid/config.py
@@ -73,6 +73,7 @@ from pyramid.asset import PackageOverrides
from pyramid.asset import resolve_asset_spec
from pyramid.security import NO_PERMISSION_REQUIRED
from pyramid.settings import Settings
+from pyramid.settings import aslist
from pyramid.static import StaticURLInfo
from pyramid.threadlocal import get_current_registry
from pyramid.threadlocal import get_current_request
@@ -771,10 +772,8 @@ class Configurator(object):
tweens = []
includes = []
if settings:
- includes = [x.strip() for x in
- settings.get('pyramid.include', '').splitlines()]
- tweens = [x.strip() for x in
- settings.get('pyramid.tweens','').splitlines()]
+ includes = aslist(settings.get('pyramid.includes', ''))
+ tweens = aslist(settings.get('pyramid.tweens', ''))
registry = self.registry
self._fix_registry()
self._set_settings(settings)
diff --git a/pyramid/scaffolds/alchemy/development.ini_tmpl b/pyramid/scaffolds/alchemy/development.ini_tmpl
index 4dc4c2461..d946d7291 100644
--- a/pyramid/scaffolds/alchemy/development.ini_tmpl
+++ b/pyramid/scaffolds/alchemy/development.ini_tmpl
@@ -7,8 +7,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
sqlalchemy.url = sqlite:///%(here)s/{{project}}.db
diff --git a/pyramid/scaffolds/routesalchemy/development.ini_tmpl b/pyramid/scaffolds/routesalchemy/development.ini_tmpl
index 4dc4c2461..d946d7291 100644
--- a/pyramid/scaffolds/routesalchemy/development.ini_tmpl
+++ b/pyramid/scaffolds/routesalchemy/development.ini_tmpl
@@ -7,8 +7,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
sqlalchemy.url = sqlite:///%(here)s/{{project}}.db
diff --git a/pyramid/scaffolds/routesalchemy/production.ini_tmpl b/pyramid/scaffolds/routesalchemy/production.ini_tmpl
index 9fd182ba3..dadf6c366 100644
--- a/pyramid/scaffolds/routesalchemy/production.ini_tmpl
+++ b/pyramid/scaffolds/routesalchemy/production.ini_tmpl
@@ -7,7 +7,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
sqlalchemy.url = sqlite:///%(here)s/{{project}}.db
diff --git a/pyramid/scaffolds/starter/development.ini_tmpl b/pyramid/scaffolds/starter/development.ini_tmpl
index bbb448055..e670c167c 100644
--- a/pyramid/scaffolds/starter/development.ini_tmpl
+++ b/pyramid/scaffolds/starter/development.ini_tmpl
@@ -7,7 +7,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
+pyramid.includes = pyramid_debugtoolbar
[pipeline:main]
pipeline =
diff --git a/pyramid/scaffolds/zodb/development.ini_tmpl b/pyramid/scaffolds/zodb/development.ini_tmpl
index 246357737..68297dfca 100644
--- a/pyramid/scaffolds/zodb/development.ini_tmpl
+++ b/pyramid/scaffolds/zodb/development.ini_tmpl
@@ -7,8 +7,8 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
pyramid.default_locale_name = en
-pyramid.include = pyramid_debugtoolbar
- pyramid_tm
+pyramid.includes = pyramid_debugtoolbar
+ pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/pyramid/scaffolds/zodb/production.ini_tmpl b/pyramid/scaffolds/zodb/production.ini_tmpl
index 336902e67..de14f0271 100644
--- a/pyramid/scaffolds/zodb/production.ini_tmpl
+++ b/pyramid/scaffolds/zodb/production.ini_tmpl
@@ -7,7 +7,7 @@ pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = false
pyramid.default_locale_name = en
-pyramid.include = pyramid_tm
+pyramid.includes = pyramid_tm
tm.attempts = 3
zodb_uri = file://%(here)s/Data.fs?connection_cache_size=20000
diff --git a/pyramid/settings.py b/pyramid/settings.py
index 7540cb6d6..677ea15f3 100644
--- a/pyramid/settings.py
+++ b/pyramid/settings.py
@@ -6,6 +6,7 @@ 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
@@ -138,3 +139,15 @@ def asbool(s):
s = str(s).strip()
return s.lower() in ('t', 'true', 'y', 'yes', 'on', '1')
+def aslist_cronly(value):
+ if isinstance(value, basestring):
+ value = filter(None, [x.strip() for x in value.splitlines()])
+ return value
+
+def aslist(value):
+ values = aslist_cronly(value)
+ result = []
+ for value in values:
+ subvalues = value.split()
+ result.extend(subvalues)
+ return result
diff --git a/pyramid/tests/test_config.py b/pyramid/tests/test_config.py
index 5eac64520..ec04f177b 100644
--- a/pyramid/tests/test_config.py
+++ b/pyramid/tests/test_config.py
@@ -577,13 +577,24 @@ class ConfiguratorTests(unittest.TestCase):
reg = Registry()
config = self._makeOne(reg)
settings = {
- 'pyramid.include': """pyramid.tests.test_config.dummy_include
+ 'pyramid.includes': """pyramid.tests.test_config.dummy_include
pyramid.tests.test_config.dummy_include2""",
}
config.setup_registry(settings=settings)
self.assert_(reg.included)
self.assert_(reg.also_included)
+ def test_setup_registry_includes_spaces(self):
+ from pyramid.registry import Registry
+ reg = Registry()
+ config = self._makeOne(reg)
+ settings = {
+ 'pyramid.includes': """pyramid.tests.test_config.dummy_include pyramid.tests.test_config.dummy_include2""",
+ }
+ config.setup_registry(settings=settings)
+ self.assert_(reg.included)
+ self.assert_(reg.also_included)
+
def test_setup_registry_tweens(self):
from pyramid.interfaces import ITweens
from pyramid.registry import Registry
diff --git a/pyramid/tests/test_settings.py b/pyramid/tests/test_settings.py
index 5037959aa..36c628f31 100644
--- a/pyramid/tests/test_settings.py
+++ b/pyramid/tests/test_settings.py
@@ -527,3 +527,41 @@ class Test_asbool(unittest.TestCase):
def test_s_is_1(self):
result = self._callFUT(1)
self.assertEqual(result, True)
+
+class Test_aslist_cronly(unittest.TestCase):
+ def _callFUT(self, val):
+ from pyramid.settings import aslist_cronly
+ return aslist_cronly(val)
+
+ def test_with_list(self):
+ result = self._callFUT(['abc', 'def'])
+ self.assertEqual(result, ['abc', 'def'])
+
+ def test_with_string(self):
+ result = self._callFUT('abc def')
+ self.assertEqual(result, ['abc def'])
+
+ def test_with_string_crsep(self):
+ result = self._callFUT(' abc\n def')
+ self.assertEqual(result, ['abc', 'def'])
+
+class Test_aslist(unittest.TestCase):
+ def _callFUT(self, val):
+ from pyramid.settings import aslist
+ return aslist(val)
+
+ def test_with_list(self):
+ result = self._callFUT(['abc', 'def'])
+ self.assertEqual(result, ['abc', 'def'])
+
+ def test_with_string(self):
+ result = self._callFUT('abc def')
+ self.assertEqual(result, ['abc', 'def'])
+
+ def test_with_string_crsep(self):
+ result = self._callFUT(' abc\n def')
+ self.assertEqual(result, ['abc', 'def'])
+
+ def test_with_string_crsep_spacesep(self):
+ result = self._callFUT(' abc\n def ghi')
+ self.assertEqual(result, ['abc', 'def', 'ghi'])