summaryrefslogtreecommitdiffstats
path: root/ipalib/__init__.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2008-08-26 00:04:15 +0000
committerJason Gerard DeRose <jderose@redhat.com>2008-08-26 00:04:15 +0000
commit0d35c96f1afd8b058a6431b944130e5d7bfe41bb (patch)
treec19bff85df2d4812b54194f4d8e50cfadbba05ce /ipalib/__init__.py
parent2fc3819beca86c3d19d85e2f5777af3566305175 (diff)
downloadfreeipa-0d35c96f1afd8b058a6431b944130e5d7bfe41bb.tar.gz
freeipa-0d35c96f1afd8b058a6431b944130e5d7bfe41bb.tar.xz
freeipa-0d35c96f1afd8b058a6431b944130e5d7bfe41bb.zip
192: Added a quick console example to docstring in ipalib/__init__.py
Diffstat (limited to 'ipalib/__init__.py')
-rw-r--r--ipalib/__init__.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/ipalib/__init__.py b/ipalib/__init__.py
index 2436d9b14..7f2249efa 100644
--- a/ipalib/__init__.py
+++ b/ipalib/__init__.py
@@ -30,6 +30,30 @@ To learn about the ``ipalib`` library, you should read the code in this order:
Some of the plugin architecture was inspired by ``bzr``, so you might also
read http://bazaar-vcs.org/WritingPlugins
+
+Here is a short console example on using the plugable API:
+
+>>> from ipalib import api
+>>> list(api.register) # Plugins must subclass from one of these base classes:
+['Command', 'Method', 'Object', 'Property']
+>>> 'user_add' in api.register.Command # Has 'user_add' been registered?
+False
+>>> import ipalib.load_plugins # This causes all plugins to be loaded
+>>> 'user_add' in api.register.Command # Yes, 'user_add' has been registered:
+True
+>>> list(api) # API is empty till finalize() is called:
+[]
+>>> api.finalize() # Instantiates plugins, builds API namespaces:
+>>> list(api) # Lists the namespaces in the API:
+['Command', 'Method', 'Object', 'Property']
+>>> 'user_add' in api.Command # Yes, the 'user_add' command exists:
+True
+>>> api['Command'] is api.Command # Access as dict item or as attribute:
+True
+>>> list(api.Command) # List available commands:
+['discover', 'group_add', 'group_del', 'group_find', 'group_mod', 'krbtest', 'service_add', 'service_del', 'service_find', 'service_mod', 'user_add', 'user_del', 'user_find', 'user_mod']
+>>> list(api.Command.user_add) # List public methods for user_add:
+['__call__', 'default', 'execute', 'get_doc', 'normalize', 'options', 'validate']
"""
import plugable