2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-10-21 14:47:45 +00:00

1. Refactor the function get_param_name_by_position of class CommandInfo, add add some unittest for it.

git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@990 e5f2f494-b856-4b98-b285-d166d9295462
This commit is contained in:
Likun Zhang
2010-02-26 08:52:21 +00:00
parent 8d57d033cc
commit 5379b40c81
4 changed files with 50 additions and 38 deletions

View File

@@ -206,6 +206,12 @@ class BindCmdInterpreter(Cmd):
self.add_module_info(module)
def _validate_cmd(self, cmd):
'''validate the parameters and merge some parameters together,
merge algorithm is based on the command line syntax, later, if
a better command line syntax come out, this function should be
updated first.
'''
if not cmd.module in self.modules:
raise CmdUnknownModuleSyntaxError(cmd.module)
@@ -254,7 +260,7 @@ class BindCmdInterpreter(Cmd):
raise CmdUnknownParamSyntaxError(cmd.module, cmd.command, cmd.params[name])
else:
# replace the numbered items by named items
param_name = command_info.get_param_name_by_position(name+1, param_count)
param_name = command_info.get_param_name_by_position(name, param_count)
cmd.params[param_name] = cmd.params[name]
del cmd.params[name]