summaryrefslogtreecommitdiffstats
path: root/ipaclient/frontend.py
diff options
context:
space:
mode:
authorDavid Kupka <dkupka@redhat.com>2016-07-20 13:23:33 +0200
committerJan Cholasta <jcholast@redhat.com>2016-08-03 16:32:39 +0200
commit29f7f822aba674ebc4184ecc126854adb4330a89 (patch)
tree27e2da44c822334e41b1dc9ecd13d78d10840bfa /ipaclient/frontend.py
parent47a693d17430e82787d9704637c022a2fcac531a (diff)
downloadfreeipa-29f7f822aba674ebc4184ecc126854adb4330a89.tar.gz
freeipa-29f7f822aba674ebc4184ecc126854adb4330a89.tar.xz
freeipa-29f7f822aba674ebc4184ecc126854adb4330a89.zip
frontend: Change doc, summary, topic and NO_CLI to class properties
Avoid need to instantiate all commands just to get information for displaying help. https://fedorahosted.org/freeipa/ticket/6048 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipaclient/frontend.py')
-rw-r--r--ipaclient/frontend.py32
1 files changed, 22 insertions, 10 deletions
diff --git a/ipaclient/frontend.py b/ipaclient/frontend.py
index 1525c88b3..aeaed5507 100644
--- a/ipaclient/frontend.py
+++ b/ipaclient/frontend.py
@@ -2,9 +2,11 @@
# Copyright (C) 2016 FreeIPA Contributors see COPYING for license
#
+from ipalib import api
from ipalib.frontend import Command, Method
from ipalib.parameters import Str
from ipalib.text import _
+from ipalib.util import classproperty
class ClientCommand(Command):
@@ -111,20 +113,30 @@ class CommandOverride(Command):
def __init__(self, api):
super(CommandOverride, self).__init__(api)
- next_class = api.get_plugin_next(type(self))
+ next_class = self.__get_next()
self.next = next_class(api)
- @property
- def doc(self):
- return self.next.doc
+ @classmethod
+ def __get_next(cls):
+ return api.get_plugin_next(cls)
- @property
- def NO_CLI(self):
- return self.next.NO_CLI
+ @classmethod
+ def __doc_getter(cls):
+ return cls.__get_next().doc
- @property
- def topic(self):
- return self.next.topic
+ doc = classproperty(__doc_getter)
+
+ @classmethod
+ def __NO_CLI_getter(cls):
+ return cls.__get_next().NO_CLI
+
+ NO_CLI = classproperty(__NO_CLI_getter)
+
+ @classmethod
+ def __topic_getter(cls):
+ return cls.__get_next().topic
+
+ topic = classproperty(__topic_getter)
@property
def forwarded_name(self):