From 461f547e6ae29df72534cce65eb490a7898c1f0a Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Mon, 20 Oct 2008 20:28:24 -0600 Subject: Added docstring (with example) to frontend.Attribute class --- ipalib/frontend.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'ipalib') diff --git a/ipalib/frontend.py b/ipalib/frontend.py index dbbb2bc56..e0d6fa787 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -857,6 +857,40 @@ class Object(plugable.Plugin): class Attribute(plugable.Plugin): + """ + Base class implementing the attribute-to-object association. + + `Attribute` plugins are associated with an `Object` plugin to group + a common set of commands that operate on a common set of parameters. + + The association between attribute and object is done using a simple + naming convention: the first part of the plugin class name (up to the + first underscore) is the object name, and rest is the attribute name, + as this table shows: + + ============= =========== ============== + Class name Object name Attribute name + ============= =========== ============== + user_add user add + noun_verb noun verb + door_open_now door open_door + ============= =========== ============== + + For example: + + >>> class user_add(Attribute): + ... pass + ... + >>> instance = user_add() + >>> instance.obj_name + 'user' + >>> instance.attr_name + 'add' + + In practice the `Attribute` class is not used directly, but rather is + only the base class for the `Method` and `Property` classes. Also see + the `Object` class. + """ __public__ = frozenset(( 'obj', 'obj_name', -- cgit