diff options
author | Pavel Zuna <pzuna@redhat.com> | 2009-02-23 18:41:16 +0100 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-23 13:49:21 -0500 |
commit | 016b82250ea15dbdcb61da264fd45356422dbd8b (patch) | |
tree | 12efbfbf7754af89a1908d8c19c051795c3302e9 /ipalib/crud.py | |
parent | f2abe05398e5979dfa723dc353d96dc53fd9fc6f (diff) | |
download | freeipa-016b82250ea15dbdcb61da264fd45356422dbd8b.tar.gz freeipa-016b82250ea15dbdcb61da264fd45356422dbd8b.tar.xz freeipa-016b82250ea15dbdcb61da264fd45356422dbd8b.zip |
Add ipalib.frontend.Command method to build an entry from params with attribute=True.
Often plugins need to build LDAP entries from params. This should make things a bit easier.
Crud methods (Create, Retrieve, Update, Delete, Search) have attribute=True by default.
And it also works for multivalue params.
Diffstat (limited to 'ipalib/crud.py')
-rw-r--r-- | ipalib/crud.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ipalib/crud.py b/ipalib/crud.py index a522ad84e..990fc39bc 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -78,14 +78,14 @@ class Create(frontend.Method): """ def get_args(self): - yield self.obj.primary_key + yield self.obj.primary_key.clone(attribute=True) def get_options(self): if self.extra_options_first: for option in super(Create, self).get_options(): yield option for option in self.obj.params_minus(self.args): - yield option + yield option.clone(attribute=True) if not self.extra_options_first: for option in super(Create, self).get_options(): yield option @@ -97,7 +97,7 @@ class PKQuery(frontend.Method): """ def get_args(self): - yield self.obj.primary_key.clone(query=True) + yield self.obj.primary_key.clone(attribute=True, query=True) @@ -117,7 +117,7 @@ class Update(PKQuery): for option in super(Update, self).get_options(): yield option for option in self.obj.params_minus_pk(): - yield option.clone(required=False) + yield option.clone(attribute=True, required=False) if not self.extra_options_first: for option in super(Update, self).get_options(): yield option @@ -141,7 +141,7 @@ class Search(frontend.Method): for option in super(Search, self).get_options(): yield option for option in self.obj.params_minus(self.args): - yield option.clone(query=True, required=False) + yield option.clone(attribute=True, query=True, required=False) if not self.extra_options_first: for option in super(Search, self).get_options(): yield option |