From 4f689c41d9d5aa1161b185de9bd7fb6d85b6cc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Junior=20B=C3=A1ez?= Date: Sat, 27 May 2017 18:02:18 -0400 Subject: [PATCH] #2341: Accept default argument value when args lenght equal 1 --- flask/cli.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/flask/cli.py b/flask/cli.py index 363b02ed..346f0bf8 100644 --- a/flask/cli.py +++ b/flask/cli.py @@ -87,12 +87,15 @@ def call_factory(app_factory, script_info, arguments=()): of arguments. Checks for the existence of a script_info argument and calls the app_factory depending on that and the arguments provided. """ - arg_names = getargspec(app_factory).args + args_spec = getargspec(app_factory) + arg_names = args_spec.args + arg_defaults = args_spec.defaults + if 'script_info' in arg_names: return app_factory(*arguments, script_info=script_info) elif arguments: return app_factory(*arguments) - elif not arguments and len(arg_names) == 1: + elif not arguments and len(arg_names) == 1 and arg_defaults is None: return app_factory(script_info) return app_factory()