diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 00:42:38 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-09-25 00:42:38 +0000 |
commit | 4747563a802a08863d2195222b2f428e52af8502 (patch) | |
tree | b2e0ed40a5b62fe1a09a4d5b36fa8bc76d0687b0 /ipalib/frontend.py | |
parent | 79b33ad3663b91ad7816cf55737faa28603fca70 (diff) | |
download | freeipa-4747563a802a08863d2195222b2f428e52af8502.tar.gz freeipa-4747563a802a08863d2195222b2f428e52af8502.tar.xz freeipa-4747563a802a08863d2195222b2f428e52af8502.zip |
356: Modified Method.get_options() to now pull from self.obj.params(); updated unit tests for Method.get_options()
Diffstat (limited to 'ipalib/frontend.py')
-rw-r--r-- | ipalib/frontend.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 6aa21eb80..9f4f52958 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -541,8 +541,13 @@ class Object(plugable.Plugin): def __create_params(self): props = self.properties.__todict__() for spec in self.takes_params: - if type(spec) is str and spec.rstrip('?*+') in props: - yield props.pop(spec.rstrip('?*+')).param + if type(spec) is str: + key = spec.rstrip('?*+') + else: + assert type(spec) is Param + key = spec.name + if key in props: + yield props.pop(key).param else: yield create_param(spec) def get_key(p): @@ -602,15 +607,9 @@ class Method(Attribute, Command): def get_options(self): for option in self.takes_options: yield option - if self.obj is not None and self.obj.properties is not None: - def get_key(p): - if p.param.required: - if p.param.default_from is None: - return 0 - return 1 - return 2 - for prop in sorted(self.obj.properties(), key=get_key): - yield prop.param + if self.obj is not None and self.obj.params is not None: + for param in self.obj.params(): + yield param class Property(Attribute): |