diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-06 15:54:27 +0000 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2008-08-06 15:54:27 +0000 |
commit | 57534ca5a0f5443c80ffba4c1640650a5989c7b8 (patch) | |
tree | 5c55cecf7f37382d83ddce99c551dceb81254586 /ipalib/public.py | |
parent | 495f96a73f20f0d0331099251d2472f216d05cac (diff) | |
download | freeipa.git-57534ca5a0f5443c80ffba4c1640650a5989c7b8.tar.gz freeipa.git-57534ca5a0f5443c80ffba4c1640650a5989c7b8.tar.xz freeipa.git-57534ca5a0f5443c80ffba4c1640650a5989c7b8.zip |
63: Started fleshing out public.cmd
Diffstat (limited to 'ipalib/public.py')
-rw-r--r-- | ipalib/public.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ipalib/public.py b/ipalib/public.py index 941011b6..5c413ab0 100644 --- a/ipalib/public.py +++ b/ipalib/public.py @@ -41,10 +41,35 @@ class cmd_proxy(plugable.Proxy): class cmd(plugable.Plugin): proxy = cmd_proxy + __opt = None def get_doc(self, _): + """ + Returns the gettext translated doc-string for this command. + + For example: + + >>> def get_doc(self, _): + >>> return _('add new user') + """ raise NotImplementedError('%s.get_doc()' % self.name) + def get_options(self): + """ + Returns iterable with opt_proxy objects used to create the opt + NameSpace when __get_opt() is called. + """ + raise NotImplementedError('%s.get_options()' % self.name) + + def __get_opt(self): + """ + Returns the NameSpace containing opt_proxy objects. + """ + if self.__opt is None: + self.__opt = plugable.NameSpace(self.get_options()) + return self.__opt + opt = property(__get_opt) + def __call__(self, *args, **kw): print repr(self) |