#2341: Accept default argument value when args lenght equal 1

This commit is contained in:
Junior Báez 2017-05-27 18:02:18 -04:00
parent 6a8c8c3484
commit 4f689c41d9

View file

@ -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()