From e96817beccacd6e9cc7f6e0f13698ab891226dbc Mon Sep 17 00:00:00 2001 From: John Anderson Date: Wed, 14 Nov 2012 11:32:17 -0300 Subject: Don't use a global mutable and updated the doc string to include options --- pyramid/paster.py | 8 ++++++-- pyramid/tests/test_scripts/test_prequest.py | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/pyramid/paster.py b/pyramid/paster.py index b1a6d4c8b..6dd7f9086 100644 --- a/pyramid/paster.py +++ b/pyramid/paster.py @@ -9,7 +9,7 @@ from pyramid.compat import configparser from logging.config import fileConfig from pyramid.scripting import prepare -def get_app(config_uri, name=None, options={}, loadapp=loadapp): +def get_app(config_uri, name=None, options=None, loadapp=loadapp): """ Return the WSGI application named ``name`` in the PasteDeploy config file specified by ``config_uri``. @@ -72,7 +72,7 @@ def _getpathsec(config_uri, name): section = name return path, section -def bootstrap(config_uri, request=None, options={}): +def bootstrap(config_uri, request=None, options=None): """ Load a WSGI application from the PasteDeploy config file specified by ``config_uri``. The environment will be configured as if it is currently serving ``request``, leaving a natural environment in place @@ -112,6 +112,10 @@ def bootstrap(config_uri, request=None, options={}): for you if none is provided. You can mutate the request's ``environ`` later to setup a specific host/port/scheme/etc. + ``options`` Is passed to get_app for use as variable assignments like + {'http_port': 8080} and then use %(http_port)s in the + config file. + See :ref:`writing_a_script` for more information about how to use this function. """ diff --git a/pyramid/tests/test_scripts/test_prequest.py b/pyramid/tests/test_scripts/test_prequest.py index 76cb35881..91d2b322a 100644 --- a/pyramid/tests/test_scripts/test_prequest.py +++ b/pyramid/tests/test_scripts/test_prequest.py @@ -13,10 +13,10 @@ class TestPRequestCommand(unittest.TestCase): cmd.out = self.out return cmd - def get_app(self, spec, app_name=None, options={}): + def get_app(self, spec, app_name=None, options=None): self._spec = spec self._app_name = app_name - self._options = options + self._options = options or {} def helloworld(environ, start_request): self._environ = environ -- cgit v1.2.3