summaryrefslogtreecommitdiffstats
path: root/ipalib/base.py
diff options
context:
space:
mode:
authorJason Gerard DeRose <jderose@redhat.com>2009-01-05 12:41:02 -0700
committerJason Gerard DeRose <jderose@redhat.com>2009-01-05 12:41:02 -0700
commit2462135da0f230b9795755fbf7e9bd917d13acf3 (patch)
tree480c97c454ba2093900fe1b47bb93716310a38fd /ipalib/base.py
parent4a24b49d5d1df0558242c4a8e7e3f9333fc007db (diff)
downloadfreeipa-2462135da0f230b9795755fbf7e9bd917d13acf3.tar.gz
freeipa-2462135da0f230b9795755fbf7e9bd917d13acf3.tar.xz
freeipa-2462135da0f230b9795755fbf7e9bd917d13acf3.zip
Added a few missing things to base.ReadOnly docstrings
Diffstat (limited to 'ipalib/base.py')
-rw-r--r--ipalib/base.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/ipalib/base.py b/ipalib/base.py
index d83948747..bff8f1951 100644
--- a/ipalib/base.py
+++ b/ipalib/base.py
@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""
-Core functions and classes.
+Foundational classes and functions.
"""
import re
@@ -54,7 +54,11 @@ class ReadOnly(object):
But after an instance is locked, you cannot set its attributes:
+ >>> p.__islocked__() # Is this instance locked?
+ False
>>> p.__lock__() # This will lock the instance
+ >>> p.__islocked__()
+ True
>>> p.department = 'Engineering'
Traceback (most recent call last):
...
@@ -79,7 +83,20 @@ class ReadOnly(object):
False
But again, the point is that a programmer would never employ the above
- techniques accidentally.
+ techniques *accidentally*.
+
+ Lastly, this example aside, you should use the `lock()` function rather
+ than the `ReadOnly.__lock__()` method. And likewise, you should
+ use the `islocked()` function rather than the `ReadOnly.__islocked__()`
+ method. For example:
+
+ >>> readonly = ReadOnly()
+ >>> islocked(readonly)
+ False
+ >>> lock(readonly) is readonly # lock() returns the instance
+ True
+ >>> islocked(readonly)
+ True
"""
__locked = False