From: W. Trevor King Date: Wed, 12 May 2010 11:31:34 +0000 (-0400) Subject: Rework hooke.command.Command.handle_arguments (again :p). X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0c4e16451e80bd81e7e99b95c46bf9de9601f4d0;p=hooke.git Rework hooke.command.Command.handle_arguments (again :p). Previous implementation didn't set params[name] when num_provided == 0 and argument.callback != None --- diff --git a/hooke/command.py b/hooke/command.py index 21e09b8..5c0f1b2 100644 --- a/hooke/command.py +++ b/hooke/command.py @@ -162,13 +162,15 @@ class Command (object): '\n '.join(['%s: %s' % (name,value) for name,value in sorted(settings)]))) name,value = settings[0] - if name != argument.name: - params.remove(name) + if num_provided == 0: params[argument.name] = value - if argument.callback != None: - if num_provided > 0: + else: + if name != argument.name: + params.remove(name) + params[argument.name] = value + if argument.callback != None: value = argument.callback(hooke, self, argument, value) - params[argument.name] = value + params[argument.name] = value argument.validate(value) return params