plugable: use plugin class as the key in API namespaces

When iterating over APINameSpace objects, use plugin class rather than its
name as the key.

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

Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
Jan Cholasta
2016-06-20 07:41:08 +02:00
parent 9a21964877
commit 79d1f58335
4 changed files with 83 additions and 69 deletions

View File

@@ -389,7 +389,7 @@ class Command(HasParam):
>>> api.add_plugin(my_command)
>>> api.finalize()
>>> list(api.Command)
['my_command']
[<class '__main__.my_command'>]
>>> api.Command.my_command # doctest:+ELLIPSIS
ipalib.frontend.my_command()
@@ -1381,7 +1381,7 @@ class Method(Attribute, Command):
namespace:
>>> list(api.Method)
['user_add']
[<class '__main__.user_add'>]
>>> api.Method.user_add(version=u'2.88') # Will call user_add.run()
{'result': 'Added the user!'}
@@ -1392,7 +1392,7 @@ class Method(Attribute, Command):
plugin can also be accessed through the ``api.Command`` namespace:
>>> list(api.Command)
['user_add']
[<class '__main__.user_add'>]
>>> api.Command.user_add(version=u'2.88') # Will call user_add.run()
{'result': 'Added the user!'}
@@ -1400,7 +1400,7 @@ class Method(Attribute, Command):
`Object`:
>>> list(api.Object)
['user']
[<class '__main__.user'>]
>>> list(api.Object.user.methods)
['add']
>>> api.Object.user.methods.add(version=u'2.88') # Will call user_add.run()
@@ -1443,7 +1443,7 @@ class Updater(Plugin):
>>> api.add_plugin(my_update)
>>> api.finalize()
>>> list(api.Updater)
['my_update']
[<class '__main__.my_update'>]
>>> api.Updater.my_update # doctest:+ELLIPSIS
ipalib.frontend.my_update()
"""