Fix for the command argument constraints

This commit is contained in:
red-agent 2009-10-09 16:16:59 +03:00
parent ad0bb43793
commit 86d0ad3cc3
1 changed files with 10 additions and 0 deletions

View File

@ -270,6 +270,16 @@ def adapt_arguments(command, arguments, args, opts):
if value not in initial:
raise CommandError("%s: Invalid argument" % key, command)
# If argument to an option constrained by a sequence was not given - then
# it's value should be set to None.
for spec_key, spec_value in spec_kwargs:
if isinstance(spec_value, (TupleType, ListType)):
for key, value in opts:
if spec_key == key:
break
else:
opts.append((spec_key, None))
# We need to encode every keyword argument to a simple string, not the
# unicode one, because ** expansion does not support it.
for index, (key, value) in enumerate(opts):