From e76160b01db52f9e750a605983eb85ae97305629 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sat, 19 Jul 2008 21:51:07 +0000 Subject: 8: Experimental work on more OO definition of what gets pluged into API.commands --- ipalib/crud.py | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 ipalib/crud.py (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py new file mode 100644 index 00000000..1be72767 --- /dev/null +++ b/ipalib/crud.py @@ -0,0 +1,83 @@ +# Authors: +# Jason Gerard DeRose +# +# Copyright (C) 2008 Red Hat +# see file 'COPYING' for use and warranty information +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 only +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" + +""" + +from base import NameSpace + +class Named(object): + def __get_name(self): + return self.__class__.__name__ + name = property(__get_name) + +class ObjectMember(Named): + def __init__(self, obj): + self.__obj = obj + + def __get_obj(self): + return self.__obj + obj = property(__get_obj) + + +class Command(ObjectMember): + def __get_full_name(self): + return '%s_%s' % (self.name, self.obj.name) + full_name = property(__get_full_name) + +class Attribute(ObjectMember): + def __get_full_name(self): + return '%s_%s' % (self.obj.name, self.name) + full_name = property(__get_full_name) + + +class Object(Named): + def __init__(self): + self.__commands = self.__build_ns(self.get_commands) + self.__attributes = self.__build_ns(self.get_attributes, True) + + def __get_commands(self): + return self.__commands + commands = property(__get_commands) + + def __get_attributes(self): + return self.__attributes + attributes = property(__get_attributes) + + def __build_ns(self, callback, preserve=False): + d = {} + o = [] + for cls in callback(): + i = cls(self) + assert i.name not in d + d[i.name] = i + o.append(i.name) + if preserve: + return NameSpace(d, order=o) + return NameSpace(d) + + def __get_commands(self): + return + + def get_commands(self): + raise NotImplementedError + + def get_attributes(self): + raise NotImplementedError -- cgit From ccd8eb3373b0b195c1bc6efd8650320419c709a6 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sat, 19 Jul 2008 23:40:23 +0000 Subject: 9: Reorganized new work and unit tests based around base.Object being the plugin definining unit --- ipalib/crud.py | 71 ++++++++++++++++++++-------------------------------------- 1 file changed, 24 insertions(+), 47 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 1be72767..afbad47a 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -18,66 +18,43 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA """ - +Base classes for objects with CRUD functionality. """ -from base import NameSpace - -class Named(object): - def __get_name(self): - return self.__class__.__name__ - name = property(__get_name) - -class ObjectMember(Named): - def __init__(self, obj): - self.__obj = obj +import base - def __get_obj(self): - return self.__obj - obj = property(__get_obj) +class create(base.Command): + pass -class Command(ObjectMember): - def __get_full_name(self): - return '%s_%s' % (self.name, self.obj.name) - full_name = property(__get_full_name) +class retrieve(base.Command): + pass -class Attribute(ObjectMember): - def __get_full_name(self): - return '%s_%s' % (self.obj.name, self.name) - full_name = property(__get_full_name) +class update(base.Command): + pass -class Object(Named): - def __init__(self): - self.__commands = self.__build_ns(self.get_commands) - self.__attributes = self.__build_ns(self.get_attributes, True) - def __get_commands(self): - return self.__commands - commands = property(__get_commands) +class delete(base.Command): + pass - def __get_attributes(self): - return self.__attributes - attributes = property(__get_attributes) - def __build_ns(self, callback, preserve=False): - d = {} - o = [] - for cls in callback(): - i = cls(self) - assert i.name not in d - d[i.name] = i - o.append(i.name) - if preserve: - return NameSpace(d, order=o) - return NameSpace(d) +class search(base.Command): + pass - def __get_commands(self): - return +class user(base.Object): def get_commands(self): - raise NotImplementedError + return [ + create, + retrieve, + update, + delete, + ] def get_attributes(self): - raise NotImplementedError + return [ + givenName, + sn, + login, + ] -- cgit From 7acf12e988f45d503d7d93f03f706618f7696504 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 20 Jul 2008 01:29:59 +0000 Subject: 10: Updated base.API to reflect the fact that base.Object is now the new unit of plugin functionality; updated corresponding unit tests --- ipalib/crud.py | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index afbad47a..c20b4cc1 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -23,15 +23,15 @@ Base classes for objects with CRUD functionality. import base -class create(base.Command): +class add(base.Command): pass -class retrieve(base.Command): +class get(base.Command): pass -class update(base.Command): +class edit(base.Command): pass @@ -39,22 +39,16 @@ class delete(base.Command): pass -class search(base.Command): +class find(base.Command): pass -class user(base.Object): +class CrudLike(base.Object): def get_commands(self): return [ - create, - retrieve, - update, + add, + get, + edit, delete, - ] - - def get_attributes(self): - return [ - givenName, - sn, - login, + find, ] -- cgit From 700d58ac1e29378569f2f9ac1a4fe39c8747aeba Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 20 Jul 2008 02:03:15 +0000 Subject: 11: Added submodules needed to triger the plugin loading, etc., so I can start work on the cli demo --- ipalib/crud.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index c20b4cc1..2ae736f5 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -26,29 +26,23 @@ import base class add(base.Command): pass - -class get(base.Command): +class find(base.Command): pass - class edit(base.Command): pass - class delete(base.Command): pass -class find(base.Command): - pass class CrudLike(base.Object): def get_commands(self): return [ add, - get, + find, edit, delete, - find, ] -- cgit From 9b3e2f5cec773e06815fc85511f0c38410993edc Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 20 Jul 2008 18:10:08 +0000 Subject: 18: Moved base2 stuff into base --- ipalib/crud.py | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 2ae736f5..89f7001b 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -23,26 +23,15 @@ Base classes for objects with CRUD functionality. import base -class add(base.Command): - pass -class find(base.Command): - pass +class Add(base.Command): + pass -class edit(base.Command): - pass +class Del(base.Command): + pass -class delete(base.Command): - pass +class Mod(base.Command): + pass - - - -class CrudLike(base.Object): - def get_commands(self): - return [ - add, - find, - edit, - delete, - ] +class Find(base.Command): + pass -- cgit From 48c7da47c78c5b5f97dc01a7593313943aef7b6e Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Sun, 20 Jul 2008 23:43:16 +0000 Subject: 25: Updated plugin examples, ipa script --- ipalib/crud.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 89f7001b..b61239d2 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -24,14 +24,14 @@ Base classes for objects with CRUD functionality. import base -class Add(base.Command): +class Add(base.Method): pass -class Del(base.Command): +class Del(base.Method): pass -class Mod(base.Command): +class Mod(base.Method): pass -class Find(base.Command): +class Find(base.Method): pass -- cgit From 293b31ac75cd4f72c5d4a62ffc82df83c70f564f Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 6 Aug 2008 14:30:21 +0000 Subject: 60: Remeved depreciated base.py, crud.py; remeved corresponding test_base.py, test_crud.py --- ipalib/crud.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 ipalib/crud.py (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py deleted file mode 100644 index b61239d2..00000000 --- a/ipalib/crud.py +++ /dev/null @@ -1,37 +0,0 @@ -# Authors: -# Jason Gerard DeRose -# -# Copyright (C) 2008 Red Hat -# see file 'COPYING' for use and warranty information -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; version 2 only -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -""" -Base classes for objects with CRUD functionality. -""" - -import base - - -class Add(base.Method): - pass - -class Del(base.Method): - pass - -class Mod(base.Method): - pass - -class Find(base.Method): - pass -- cgit From 5479a349a87458e8e1a7997ad16720778e65be96 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 24 Sep 2008 20:17:53 +0000 Subject: 346: Added skeleton framework for crud.py module and corresponding test_crud.py module --- ipalib/crud.py | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 ipalib/crud.py (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py new file mode 100644 index 00000000..9f410fde --- /dev/null +++ b/ipalib/crud.py @@ -0,0 +1,44 @@ +# Authors: +# Jason Gerard DeRose +# +# Copyright (C) 2008 Red Hat +# see file 'COPYING' for use and warranty information +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; version 2 only +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +""" +Base classes for standard CRUD operations. +""" + +import frontend, errors + + +class Add(frontend.Method): + pass + + +class Get(frontend.Method): + pass + + +class Del(frontend.Method): + pass + + +class Mod(frontend.Method): + pass + + +class Find(frontend.Method): + pass -- cgit From 023f612921b4d9cbd15e3148d09c02932a61d73e Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 25 Sep 2008 02:13:16 +0000 Subject: 361: Implemented crud.Add.get_options() method; added corresponding unit tests --- ipalib/crud.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 9f410fde..bdcf3047 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -25,7 +25,9 @@ import frontend, errors class Add(frontend.Method): - pass + def get_options(self): + assert 'params' in self.obj, list(self.obj) + return self.obj.params() class Get(frontend.Method): -- cgit From c303a06a948d1813336161e2546bd85f8edead56 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 25 Sep 2008 03:14:12 +0000 Subject: 362: Implemented Get.get_args() and Del.get_args(); added corresponding unit tests --- ipalib/crud.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index bdcf3047..d6d42494 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -31,11 +31,13 @@ class Add(frontend.Method): class Get(frontend.Method): - pass + def get_args(self): + yield self.obj.primary_key class Del(frontend.Method): - pass + def get_args(self): + yield self.obj.primary_key class Mod(frontend.Method): -- cgit From ddbe3ae934020fc858f6834a923222c465eba22c Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 25 Sep 2008 03:42:38 +0000 Subject: 364: Implemented Mod.get_args, Mod.get_options(); added corresponding unit tests --- ipalib/crud.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index d6d42494..40b6bd78 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -26,7 +26,6 @@ import frontend, errors class Add(frontend.Method): def get_options(self): - assert 'params' in self.obj, list(self.obj) return self.obj.params() @@ -41,7 +40,13 @@ class Del(frontend.Method): class Mod(frontend.Method): - pass + def get_args(self): + yield self.obj.primary_key + + def get_options(self): + for param in self.obj.params_minus_pk(): + yield param.__clone__(required=False) + class Find(frontend.Method): -- cgit From 55ba8e9d0b86bf25a2cbb7a3a603d796e7a2be2b Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 25 Sep 2008 03:47:22 +0000 Subject: 365: Implemented find.get_args(), find.get_options(); added corresponding unit tests --- ipalib/crud.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 40b6bd78..5021d06d 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -48,6 +48,10 @@ class Mod(frontend.Method): yield param.__clone__(required=False) - class Find(frontend.Method): - pass + def get_args(self): + yield self.obj.primary_key + + def get_options(self): + for param in self.obj.params_minus_pk(): + yield param.__clone__(required=False) -- cgit From b965e558b5def14c6416beb36dc790cca96c3724 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 25 Sep 2008 23:53:53 -0400 Subject: Rebase XML-RPC client and server Fix error handling in server to return exceptions generated in library code --- ipalib/crud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 5021d06d..813e0c81 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -25,8 +25,12 @@ import frontend, errors class Add(frontend.Method): + def get_args(self): + yield self.obj.primary_key + def get_options(self): - return self.obj.params() + for param in self.obj.params_minus_pk(): + yield param.__clone__(required=False) class Get(frontend.Method): -- cgit From 7ee0ccd90d99609f8e85bf0e197ca5a747231fb8 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Tue, 30 Sep 2008 20:27:52 -0600 Subject: Fixed unit tests; changed example.py so it doesn't import servercore --- ipalib/crud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 813e0c81..9f9d727f 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -30,7 +30,7 @@ class Add(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): - yield param.__clone__(required=False) + yield param class Get(frontend.Method): -- cgit From 87390665f6998116ec2429773088c7165e281611 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Thu, 9 Oct 2008 11:33:35 -0600 Subject: crud.Add.get_args() and get_options() now yield static values in takes_args, takes_options after the automagic ones --- ipalib/crud.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 9f9d727f..1bdd03f8 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -27,10 +27,14 @@ import frontend, errors class Add(frontend.Method): def get_args(self): yield self.obj.primary_key + for arg in self.takes_args: + yield arg def get_options(self): for param in self.obj.params_minus_pk(): yield param + for option in self.takes_options: + yield option class Get(frontend.Method): -- cgit From 225e2b0c939d81b490c955762e125e8afcd5bb94 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 13 Oct 2008 09:50:29 -0600 Subject: Added CrudBackend abstract class defining generic CRUD API --- ipalib/crud.py | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 1bdd03f8..5a60ac8c 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -21,7 +21,7 @@ Base classes for standard CRUD operations. """ -import frontend, errors +import backend, frontend, errors class Add(frontend.Method): @@ -63,3 +63,77 @@ class Find(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): yield param.__clone__(required=False) + + +class CrudBackend(backend.Backend): + """ + Base class defining generic CRUD backend API. + """ + + def create(self, *kw): + """ + Create a new entry. + + This method should take key word arguments representing the + attributes the created entry will have. + + If this methods constructs the primary_key internally, it should raise + an exception if the primary_key was passed. Likewise, if this method + requires the primary_key to be passed in from the caller, it should + raise an exception if the primary key was *not* passed. + + This method should return a dict of the exact entry as it was created + in the backing store, including any automatically created attributes. + """ + raise NotImplementedError('%s.create()' % self.name) + + def retrieve(self, primary_key): + """ + Retrieve an existing entry. + + This method should take a single argument, the primary_key of the + entry in question. + + If such an entry exists, this method should return a dict + representing that entry. If no such entry exists, this method + should return None. + """ + raise NotImplementedError('%s.retrieve()' % self.name) + + def update(self, primary_key, *kw): + """ + Update an existing entry. + + This method should take one required argument, the primary_key of the + entry to modify, plus optional keyword arguments for each of the + attributes being updated. + + This method should return a dict representing the entry as it now + exists in the backing store. If no such entry exists, this method + should return None. + """ + raise NotImplementedError('%s.update()' % self.name) + + def delete(self, primary_key): + """ + Delete an existing entry. + + This method should take one required argument, the primary_key of the + entry to delete. + """ + raise NotImplementedError('%s.delete()' % self.name) + + def search(self, **kw): + """ + Return entries matching specific criteria. + + This method should take keyword arguments representing the search + criteria. If a key is the name of an entry attribute, the value + should be treated as a filter on that attribute. The meaning of + keys outside this namespace is left to the implementation. + + This method should return and iterable containing the matched + entries, where each entry is a dict. If no entries are matched, + this method should return an empty iterable. + """ + raise NotImplementedError('%s.search()' % self.name) -- cgit From cfc8450efd92dc0fb6648e97b27416c67625adfb Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Tue, 14 Oct 2008 22:22:01 -0400 Subject: Port user-show to new CrudBackend framework --- ipalib/crud.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 5a60ac8c..5cd7b0a4 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -87,12 +87,14 @@ class CrudBackend(backend.Backend): """ raise NotImplementedError('%s.create()' % self.name) - def retrieve(self, primary_key): + def retrieve(self, primary_key, attributes): """ Retrieve an existing entry. - This method should take a single argument, the primary_key of the - entry in question. + This method should take a two arguments: the primary_key of the + entry in question and a list of the attributes to be retrieved. + If the list of attributes is None then all non-operational + attributes will be returned. If such an entry exists, this method should return a dict representing that entry. If no such entry exists, this method -- cgit From e7937f294445d53396f7fb87d52eb4d4c9b97110 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 15 Oct 2008 09:57:49 -0400 Subject: Add missing * to *kw to make it pass named arguments instead of positional --- ipalib/crud.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 5cd7b0a4..ba4d5718 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -70,7 +70,7 @@ class CrudBackend(backend.Backend): Base class defining generic CRUD backend API. """ - def create(self, *kw): + def create(self, **kw): """ Create a new entry. @@ -102,7 +102,7 @@ class CrudBackend(backend.Backend): """ raise NotImplementedError('%s.retrieve()' % self.name) - def update(self, primary_key, *kw): + def update(self, primary_key, **kw): """ Update an existing entry. -- cgit From d2b46f176e5dbc40b67ebd90e6953498c5d6249a Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 23 Oct 2008 14:36:24 -0400 Subject: Use common display function for user-show and user-find. Add --all option to user-find Fix command-line help to make sense on searches as well --- ipalib/crud.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index ba4d5718..6194b3fa 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -63,6 +63,8 @@ class Find(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): yield param.__clone__(required=False) + for option in self.takes_options: + yield option class CrudBackend(backend.Backend): -- cgit From 62876ccee3ba679adda926b88564732552459619 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 30 Oct 2008 17:25:45 -0400 Subject: Initial implementation of automount support Add argument handling to crud.Del Make get_list handle LDAP scope --- ipalib/crud.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 6194b3fa..60c605dd 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -46,6 +46,11 @@ class Del(frontend.Method): def get_args(self): yield self.obj.primary_key + def get_options(self): + for param in self.obj.params_minus_pk(): + yield param + for option in self.takes_options: + yield option class Mod(frontend.Method): def get_args(self): @@ -54,6 +59,8 @@ class Mod(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): yield param.__clone__(required=False) + for option in self.takes_options: + yield option class Find(frontend.Method): -- cgit From f18c84444d4ed87d79f3cb41156c6b66f49ccac3 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Fri, 31 Oct 2008 17:02:51 -0400 Subject: Partially revert back change. Del shouldn't provide default options. It can provide custom ones though, if defined with takes_params() in the class. --- ipalib/crud.py | 2 -- 1 file changed, 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 60c605dd..867f9fe1 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -47,8 +47,6 @@ class Del(frontend.Method): yield self.obj.primary_key def get_options(self): - for param in self.obj.params_minus_pk(): - yield param for option in self.takes_options: yield option -- cgit From 79422d048959a7f6a5fff981caf91de924788e85 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 14 Jan 2009 13:51:37 -0700 Subject: All unit tests now working (except for doctests and Rob's xmlrpc tests) --- ipalib/crud.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index 867f9fe1..d34a7c57 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -56,7 +56,7 @@ class Mod(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): - yield param.__clone__(required=False) + yield param.clone(required=False) for option in self.takes_options: yield option @@ -67,7 +67,7 @@ class Find(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): - yield param.__clone__(required=False) + yield param.clone(required=False) for option in self.takes_options: yield option -- cgit From cd3508bacee20c01640964470b0c623691b3c216 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 14 Jan 2009 14:04:05 -0700 Subject: New Param: added Param.query kwarg for crud operations like Retrieve and Search where criteria should not be validated --- ipalib/crud.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ipalib/crud.py') diff --git a/ipalib/crud.py b/ipalib/crud.py index d34a7c57..345fc270 100644 --- a/ipalib/crud.py +++ b/ipalib/crud.py @@ -50,13 +50,14 @@ class Del(frontend.Method): for option in self.takes_options: yield option + class Mod(frontend.Method): def get_args(self): yield self.obj.primary_key def get_options(self): for param in self.obj.params_minus_pk(): - yield param.clone(required=False) + yield param.clone(required=False, query=True) for option in self.takes_options: yield option @@ -67,7 +68,7 @@ class Find(frontend.Method): def get_options(self): for param in self.obj.params_minus_pk(): - yield param.clone(required=False) + yield param.clone(required=False, query=True) for option in self.takes_options: yield option -- cgit