diff options
| -rw-r--r-- | pyramid/scripts/ptweens.py | 14 | ||||
| -rw-r--r-- | pyramid/tests/test_scripts/test_ptweens.py | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/pyramid/scripts/ptweens.py b/pyramid/scripts/ptweens.py index 7f0101323..348f2b372 100644 --- a/pyramid/scripts/ptweens.py +++ b/pyramid/scripts/ptweens.py @@ -36,6 +36,14 @@ class PTweensCommand(object): default=None, help='The URI to the configuration file.') + parser.add_argument( + 'config_vars', + nargs='*', + default=(), + help='Arbitrary options to override those in the [app:main] section ' + 'of the configuration file.', + ) + stdout = sys.stdout bootstrap = (bootstrap,) # testing @@ -62,11 +70,11 @@ class PTweensCommand(object): self.out(fmt % ('-', MAIN)) def run(self): - if not self.args: + if not self.args.config_uri: self.out('Requires a config file argument') return 2 - config_uri = self.args[0] - env = self.bootstrap[0](config_uri, options=parse_vars(self.args[1:])) + config_uri = self.args.config_uri + env = self.bootstrap[0](config_uri, options=parse_vars(self.args.config_vars)) registry = env['registry'] tweens = self._get_tweens(registry) if tweens is not None: diff --git a/pyramid/tests/test_scripts/test_ptweens.py b/pyramid/tests/test_scripts/test_ptweens.py index f39f84b68..f63069fed 100644 --- a/pyramid/tests/test_scripts/test_ptweens.py +++ b/pyramid/tests/test_scripts/test_ptweens.py @@ -9,7 +9,7 @@ class TestPTweensCommand(unittest.TestCase): def _makeOne(self): cmd = self._getTargetClass()([]) cmd.bootstrap = (dummy.DummyBootstrap(),) - cmd.args = ('/foo/bar/myapp.ini#myapp',) + cmd.args.config_uri = '/foo/bar/myapp.ini#myapp' return cmd def test_command_no_tweens(self): |
