summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-09-22 01:28:57 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-09-22 01:28:57 +0000
commitb206ef684388da64ee1deb37b064510705dd05bc (patch)
treefc301a94b187df52926de990a127055f56d1466f /ipalib
parent49c1c29df199dfce5d426ebe15003ab3f8431e71 (diff)
downloadfreeipa-b206ef684388da64ee1deb37b064510705dd05bc.tar.gz
freeipa-b206ef684388da64ee1deb37b064510705dd05bc.tar.xz
freeipa-b206ef684388da64ee1deb37b064510705dd05bc.zip
314: Completed some missing features in Command.__call__(); removed depreciated Command.print_call() method
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugable.py1
-rw-r--r--ipalib/public.py20
2 files changed, 8 insertions, 13 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 725833cd2..6e12d5c79 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -690,6 +690,7 @@ class API(DictProxy):
Dynamic API object through which `Plugin` instances are accessed.
"""
__finalized = False
+ server_context = True
def __init__(self, *allowed):
self.__d = dict()
diff --git a/ipalib/public.py b/ipalib/public.py
index 21c6822c4..e575ac84a 100644
--- a/ipalib/public.py
+++ b/ipalib/public.py
@@ -258,6 +258,7 @@ class Command(plugable.Plugin):
args = None
options = None
params = None
+ can_forward = True
def finalize(self):
self.args = plugable.NameSpace(self.__create_args(), sort=False)
@@ -328,11 +329,9 @@ class Command(plugable.Plugin):
yield(param.name, value)
def get_default(self, **kw):
- self.print_call('default', kw, 1)
return dict(self.__get_default_iter(kw))
def validate(self, **kw):
- self.print_call('validate', kw, 1)
for param in self.params():
value = kw.get(param.name, None)
if value is not None:
@@ -340,17 +339,10 @@ class Command(plugable.Plugin):
elif param.required:
raise errors.RequirementError(param.name)
- def execute(self, **kw):
- self.print_call('execute', kw, 1)
- pass
-
- def print_call(self, method, kw, tab=0):
- print '%s%s.%s(%s)\n' % (
- ' ' * (tab *2),
- self.name,
- method,
- ', '.join('%s=%r' % (k, kw[k]) for k in sorted(kw)),
- )
+ def execute(self, *args, **kw):
+ print '%s.execute():' % self.name
+ print ' args =', args
+ print ' kw =', kw
def __call__(self, *args, **kw):
if len(args) > 0:
@@ -361,6 +353,8 @@ class Command(plugable.Plugin):
kw = self.convert(**kw)
kw.update(self.get_default(**kw))
self.validate(**kw)
+ args = tuple(kw.pop(name) for name in self.args)
+ self.execute(*args, **kw)
def args_to_kw(self, *values):
if self.max_args is not None and len(values) > self.max_args: