[downloader/external] change _argless_option function to _valueless_option

This commit is contained in:
remitamine 2015-09-04 21:12:13 +01:00
parent f30c2e8e98
commit dc534b674f

View File

@ -47,7 +47,7 @@ def supports(cls, info_dict):
def _option(self, command_option, param): def _option(self, command_option, param):
param = self.params.get(param) param = self.params.get(param)
if param is None or param is False: if param is None:
return [] return []
return [command_option, param] return [command_option, param]
@ -59,7 +59,7 @@ def _bool_option(self, command_option, param, true_value='true', false_value='fa
return [command_option + separator + (true_value if param else false_value)] return [command_option + separator + (true_value if param else false_value)]
return [command_option, true_value if param else false_value] return [command_option, true_value if param else false_value]
def _argless_option(self, command_option, param, expected_value=True): def _valueless_option(self, command_option, param, expected_value=True):
param = self.params.get(param) param = self.params.get(param)
return [command_option] if param == expected_value else [] return [command_option] if param == expected_value else []
@ -91,7 +91,7 @@ def _make_cmd(self, tmpfilename, info_dict):
cmd += ['--header', '%s: %s' % (key, val)] cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--interface', 'source_address') cmd += self._option('--interface', 'source_address')
cmd += self._option('--proxy', 'proxy') cmd += self._option('--proxy', 'proxy')
cmd += self._argless_option('--insecure', 'nocheckcertificate') cmd += self._valueless_option('--insecure', 'nocheckcertificate')
cmd += self._configuration_args() cmd += self._configuration_args()
cmd += ['--', info_dict['url']] cmd += ['--', info_dict['url']]
return cmd return cmd
@ -114,7 +114,7 @@ def _make_cmd(self, tmpfilename, info_dict):
cmd += ['--header', '%s: %s' % (key, val)] cmd += ['--header', '%s: %s' % (key, val)]
cmd += self._option('--bind-address', 'source_address') cmd += self._option('--bind-address', 'source_address')
cmd += self._option('--proxy', 'proxy') cmd += self._option('--proxy', 'proxy')
cmd += self._argless_option('--no-check-certificate', 'nocheckcertificate') cmd += self._valueless_option('--no-check-certificate', 'nocheckcertificate')
cmd += self._configuration_args() cmd += self._configuration_args()
cmd += ['--', info_dict['url']] cmd += ['--', info_dict['url']]
return cmd return cmd