Skip to content

added the ability to pass options to get_app for use with string interpolation in the config #714

Merged
merged 2 commits into from Nov 21, 2012

3 participants

@sontek
Pylons Project member
sontek commented Nov 5, 2012

Sorry there aren't more/better tests. I'll try to find time to add them but I just figured I'd throw this out as is for an option to fix #612

@mmerickel
Pylons Project member

awesome!

@mmerickel
Pylons Project member

just tested this out on a new project and it seems to work well

@mcdonc
Pylons Project member
mcdonc commented Nov 14, 2012

This patch looks great; I can likely add the requisite tests. Do you think you could add your name to CONTRIBUTORS.txt?

@mcdonc mcdonc commented on an outdated diff Nov 14, 2012
pyramid/paster.py
@@ -9,17 +9,26 @@
from logging.config import fileConfig
from pyramid.scripting import prepare
-def get_app(config_uri, name=None, loadapp=loadapp):
+def get_app(config_uri, name=None, options={}, loadapp=loadapp):
@mcdonc
Pylons Project member
mcdonc added a note Nov 14, 2012

This should be options=None (using mutable default kwargs means they're global).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mcdonc mcdonc commented on an outdated diff Nov 14, 2012
pyramid/paster.py
@@ -63,7 +72,7 @@ def _getpathsec(config_uri, name):
section = name
return path, section
-def bootstrap(config_uri, request=None):
+def bootstrap(config_uri, request=None, options={}):
@mcdonc
Pylons Project member
mcdonc added a note Nov 14, 2012

Should also be options=None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mcdonc mcdonc commented on the diff Nov 14, 2012
pyramid/paster.py
@@ -106,7 +115,7 @@ def bootstrap(config_uri, request=None):
See :ref:`writing_a_script` for more information about how to use this
function.
"""
- app = get_app(config_uri)
@mcdonc
Pylons Project member
mcdonc added a note Nov 14, 2012

Should mention options in docstring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@mcdonc mcdonc commented on an outdated diff Nov 14, 2012
pyramid/tests/test_scripts/test_prequest.py
@@ -13,9 +13,11 @@ def _makeOne(self, argv, headers=None):
cmd.out = self.out
return cmd
- def get_app(self, spec, app_name=None):
+ def get_app(self, spec, app_name=None, options={}):
@mcdonc
Pylons Project member
mcdonc added a note Nov 14, 2012

Should be options=None (and assign self._options = {} if so, e.g. self._options = options or {})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sontek
Pylons Project member
sontek commented Nov 14, 2012

Made the changes you requested

@mcdonc mcdonc merged commit e96817b into Pylons:master Nov 21, 2012
@mcdonc
Pylons Project member
mcdonc commented Nov 21, 2012

Awesome, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.