diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-01-25 09:06:19 -0500 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-01-26 09:29:39 -0500 |
commit | 6cca48cb59951db833ac517aaa1274c19e40c8d8 (patch) | |
tree | cc2bd9a08e80effd6cc4b4ef2bb4496a0e215aaf /ipalib/crud.py | |
parent | c1799c836612337a13fd2301eb0911709dac4176 (diff) | |
download | freeipa-6cca48cb59951db833ac517aaa1274c19e40c8d8.tar.gz freeipa-6cca48cb59951db833ac517aaa1274c19e40c8d8.tar.xz freeipa-6cca48cb59951db833ac517aaa1274c19e40c8d8.zip |
Add flags to enforce asking for object attribute
So far the only flag to enforce asking in interactive mode was the
alwaysask attribute, which is not sufficient any more. This patch adds
the ability to control for which actions the atrribute shall be asked
for.
Diffstat (limited to 'ipalib/crud.py')
-rw-r--r-- | ipalib/crud.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/ipalib/crud.py b/ipalib/crud.py index 76d57daef..b7a665361 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -141,7 +141,13 @@ class Create(Method): for option in self.obj.params_minus(self.args): if 'no_create' in option.flags: continue - yield option.clone(attribute=True) + if 'ask_create' in option.flags: + yield option.clone( + attribute=True, query=True, required=False, + autofill=False, alwaysask=True + ) + else: + yield option.clone(attribute=True) if not self.extra_options_first: for option in super(Create, self).get_options(): yield option @@ -179,7 +185,13 @@ class Update(PKQuery): for option in self.obj.params_minus_pk(): if 'no_update' in option.flags: continue - yield option.clone(attribute=True, required=False, autofill=False) + if 'ask_update' in option.flags: + yield option.clone( + attribute=True, query=True, required=False, + autofill=False, alwaysask=True + ) + else: + yield option.clone(attribute=True, required=False, autofill=False) if not self.extra_options_first: for option in super(Update, self).get_options(): yield option @@ -210,7 +222,12 @@ class Search(Method): for option in self.obj.params_minus(self.args): if 'no_search' in option.flags: continue - if isinstance(option, parameters.Flag): + if 'ask_search' in option.flags: + yield option.clone( + attribute=True, query=True, required=False, + autofill=False, alwaysask=True + ) + elif isinstance(option, parameters.Flag): yield option.clone_retype( option.name, parameters.Bool, attribute=True, query=True, required=False, autofill=False |