plugable: Pass API to plugins on initialization rather than using set_api

https://fedorahosted.org/freeipa/ticket/3090

Reviewed-By: Martin Babinsky <mbabinsk@redhat.com>
This commit is contained in:
Jan Cholasta
2015-06-22 10:58:43 +00:00
parent 2d1515323a
commit e39fe4ed31
38 changed files with 209 additions and 278 deletions

View File

@@ -1250,12 +1250,12 @@ class Attribute(Plugin):
# Create stubs for attributes that are set in _on_finalize()
__obj = Plugin.finalize_attr('_Attribute__obj')
def __init__(self):
def __init__(self, api):
m = self.NAME_REGEX.match(type(self).__name__)
assert m
self.__obj_name = m.group('obj')
self.__attr_name = m.group('attr')
super(Attribute, self).__init__()
super(Attribute, self).__init__(api)
def __get_obj_name(self):
return self.__obj_name
@@ -1347,9 +1347,6 @@ class Method(Attribute, Command):
extra_options_first = False
extra_args_first = False
def __init__(self):
super(Method, self).__init__()
def get_output_params(self):
for param in self.obj.params():
if 'no_output' in param.flags: