From 0c4e16451e80bd81e7e99b95c46bf9de9601f4d0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 12 May 2010 07:31:34 -0400 Subject: [PATCH] Rework hooke.command.Command.handle_arguments (again :p). Previous implementation didn't set params[name] when num_provided == 0 and argument.callback != None --- hooke/command.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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 -- 2.26.2