From 31be0f5f72acf412486c66f2d423bbbec30091d5 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Tue, 6 Dec 2016 00:43:00 -0800 Subject: make prequest tests pass --- pyramid/scripts/prequest.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pyramid/scripts/prequest.py b/pyramid/scripts/prequest.py index 84e84e1c8..e4595a9cd 100644 --- a/pyramid/scripts/prequest.py +++ b/pyramid/scripts/prequest.py @@ -89,11 +89,15 @@ class PRequestCommand(object): parser.add_argument( 'config_uri', + nargs='?', + default=None, help='The URI to the configuration file.', ) parser.add_argument( 'path_info', + nargs='?', + default=None, help='The path of the request.', ) @@ -112,11 +116,11 @@ class PRequestCommand(object): setup_logging(app_spec) def run(self): - if not len(self.args) >= 2: + if not self.args.config_uri and not self.args.path_info: self.out('You must provide at least two arguments') return 2 - app_spec = self.args[0] - path = self.args[1] + app_spec = self.args.config_uri + path = self.args.path_info self.configure_logging(app_spec) @@ -146,7 +150,7 @@ class PRequestCommand(object): headers[name] = value.strip() app = self.get_app(app_spec, self.args.app_name, - options=parse_vars(self.args[2:])) + options=self.args) request_method = (self.args.method or 'GET').upper() -- cgit v1.2.3