Bug 877265 - Make dmcli parseable by python 2.6;r=ahal

This commit is contained in:
William Lachance 2013-05-30 11:04:26 -04:00
parent d9378584d2
commit 41e7f67569

View File

@ -168,7 +168,14 @@ class DMCli(object):
subparser = subparsers.add_parser(commandname, help=commandprops['help'])
if commandprops.get('args'):
for arg in commandprops['args']:
kwargs = { k: v for k,v in arg.items() if k is not 'name' }
# this is more elegant but doesn't work in python 2.6
# (which we still use on tbpl @ mozilla where we install
# this package)
# kwargs = { k: v for k,v in arg.items() if k is not 'name' }
kwargs = {}
for (k, v) in arg.items():
if k is not 'name':
kwargs[k] = v
subparser.add_argument(arg['name'], **kwargs)
subparser.set_defaults(func=commandprops['function'])