diff options
| author | Steve Piercy <web@stevepiercy.com> | 2016-12-11 04:02:01 -0800 |
|---|---|---|
| committer | Steve Piercy <web@stevepiercy.com> | 2016-12-13 17:40:20 -0800 |
| commit | ba93133ee29ecacad04770af7dffc39f2b2d3aff (patch) | |
| tree | f83b7ca13adbe66a97cd4ae3547438cc1acfc4d1 | |
| parent | 53937c4083a06479050400f96b4eae2f0795c064 (diff) | |
| download | pyramid-ba93133ee29ecacad04770af7dffc39f2b2d3aff.tar.gz pyramid-ba93133ee29ecacad04770af7dffc39f2b2d3aff.tar.bz2 pyramid-ba93133ee29ecacad04770af7dffc39f2b2d3aff.zip | |
update ptweens with config_vars argument
- replace self.args with self.args.config_uri
| -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): |
