329: Command.convert() now converts all keys, not just keys in params

This commit is contained in:
Jason Gerard DeRose 2008-09-24 05:46:49 +00:00
parent 126b31de55
commit 15b83ab1bf
2 changed files with 3 additions and 10 deletions

View File

@ -299,15 +299,10 @@ class Command(plugable.Plugin):
for option in self.get_options():
yield create_param(option)
def __convert_iter(self, kw):
for (key, value) in kw.iteritems():
if key in self.params:
yield (key, self.params[key].convert(value))
else:
yield (key, value)
def convert(self, **kw):
return dict(self.__convert_iter(kw))
return dict(
(k, self.params[k].convert(v)) for (k, v) in kw.iteritems()
)
def __normalize_iter(self, kw):
for (key, value) in kw.iteritems():

View File

@ -486,8 +486,6 @@ class test_Command(ClassChecker):
kw = dict(
option0='option0',
option1='option1',
whatever=False,
also=object,
)
expected = dict(kw)
expected.update(dict(option0=u'option0', option1=u'option1'))