From 9de2cd1d05ff62e3f75930559c2d83553df45d80 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 10 Dec 2016 05:08:32 -0800 Subject: fix pserve to allow 4 of 5 tests to pass --- pyramid/scripts/pserve.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pyramid/scripts/pserve.py b/pyramid/scripts/pserve.py index f3515804d..50f4ac1d2 100644 --- a/pyramid/scripts/pserve.py +++ b/pyramid/scripts/pserve.py @@ -100,8 +100,18 @@ class PServeCommand(object): help="Suppress verbose output") parser.add_argument( 'config_uri', + nargs='?', + default=None, help='The URI to the configuration file.', ) + parser.add_argument( + 'config_args', + nargs='*', + default=(), + help='Arbitrary options to override those in the [app:main] section ' + 'of the configuration file.', + ) + ConfigParser = configparser.ConfigParser # testing loadapp = staticmethod(loadapp) # testing @@ -120,7 +130,7 @@ class PServeCommand(object): print(msg) def get_options(self): - restvars = self.args[1:] + restvars = self.args.config_args return parse_vars(restvars) def pserve_file_config(self, filename, global_conf=None): @@ -150,10 +160,10 @@ class PServeCommand(object): self.watch_files.append(os.path.abspath(file)) def run(self): # pragma: no cover - if not self.args: + if not self.args.config_uri: self.out('You must give a config file') return 2 - app_spec = self.args[0] + app_spec = self.args.config_uri vars = self.get_options() app_name = self.args.app_name -- cgit v1.2.3