diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-18 23:15:34 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-18 23:15:34 +0000 |
commit | e0b900894fcc884fbde26ba78fa61aedec3843e9 (patch) | |
tree | 36074e07ffdc9fbbd06e31f75b7834f8d686228a /ipalib/public.py | |
parent | ef0d7a71abe0d026b1b79b6dc32d17793a8d7806 (diff) | |
download | freeipa.git-e0b900894fcc884fbde26ba78fa61aedec3843e9.tar.gz freeipa.git-e0b900894fcc884fbde26ba78fa61aedec3843e9.tar.xz freeipa.git-e0b900894fcc884fbde26ba78fa61aedec3843e9.zip |
300: Added Command.max_args instance attribute; added corresponding unit tests
Diffstat (limited to 'ipalib/public.py')
-rw-r--r-- | ipalib/public.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ipalib/public.py b/ipalib/public.py index f3626fdf..c2624f67 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -229,12 +229,15 @@ class Command(plugable.Plugin): 'options', 'group_args', )) - __Option = None takes_options = tuple() takes_args = tuple() def __init__(self): self.args = plugable.NameSpace(self.__check_args(), sort=False) + if len(self.args) == 0 or not self.args[-1].multivalue: + self.max_args = len(self.args) + else: + self.max_args = None self.options = plugable.NameSpace(self.__check_options(), sort=False) self.params = plugable.NameSpace( tuple(self.args()) + tuple(self.options()), sort=False |