Back to index

plone3  3.1.7
Public Member Functions
plone.locking.interfaces.ILockable Class Reference
Inheritance diagram for plone.locking.interfaces.ILockable:
Inheritance graph
[legend]
Collaboration diagram for plone.locking.interfaces.ILockable:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def lock
def unlock
def clear_locks
def locked
def can_safely_unlock
def stealable
def lock_info

Detailed Description

A component that is lockable.

Lock tokens are remembered (in annotations). Multiple locks can exist, 
based on lock types. The default lock type, STEALABLE_LOCK, is a lock 
that can be stolen (unless the object is marked with INonStealableLock).

Most operations take the type as a parameter and operate on the lock token
assocaited with a particular type.

Definition at line 42 of file interfaces.py.


Member Function Documentation

Determine if the current user can safely attempt to unlock the 
object.
       
That means:

 - lock_type.user_unlockable is True; and
 
 - the object is not locked; or
 - the object is only locked with the given lock_type, for the 
   current user;

Definition at line 75 of file interfaces.py.

00075 
00076     def can_safely_unlock(lock_type=STEALABLE_LOCK):
00077         """Determine if the current user can safely attempt to unlock the 
00078         object.
00079        
00080         That means:
00081         
00082          - lock_type.user_unlockable is True; and
00083          
00084          - the object is not locked; or
00085          - the object is only locked with the given lock_type, for the 
00086            current user;
00087         """
    

Here is the caller graph for this function:

Clear all locks on the object

Definition at line 67 of file interfaces.py.

00067 
00068     def clear_locks():
00069         """Clear all locks on the object
00070         """
        
def plone.locking.interfaces.ILockable.lock (   lock_type = STEALABLE_LOCK,
  children = False 
)
Lock the object using the given key.

If children is True, child objects will be locked as well.

Definition at line 53 of file interfaces.py.

00053 
00054     def lock(lock_type=STEALABLE_LOCK, children=False):
00055         """Lock the object using the given key.
00056         
00057         If children is True, child objects will be locked as well.
00058         """

Here is the caller graph for this function:

Get information about locks on object. 

Returns a list containing the following dict for each valid lock:

 - creator : the username of the lock creator
 - time    : the time at which the lock was acquired
 - token   : the underlying lock token
 - type    : the type of lock

Definition at line 100 of file interfaces.py.

00100 
00101     def lock_info():
00102         """Get information about locks on object. 
00103         
00104         Returns a list containing the following dict for each valid lock:
00105         
00106          - creator : the username of the lock creator
00107          - time    : the time at which the lock was acquired
00108          - token   : the underlying lock token
00109          - type    : the type of lock
        """

Here is the caller graph for this function:

True if the object is locked with any lock.

Definition at line 71 of file interfaces.py.

00071 
00072     def locked():
00073         """True if the object is locked with any lock.
00074         """
        

Here is the caller graph for this function:

Find out if the lock can be stolen.

This means:

 - the lock type is stealable; and

 - the object is not marked with INonStealableLock; or
 - can_safely_unlock() is true.

Definition at line 88 of file interfaces.py.

00088 
00089     def stealable(lock_type=STEALABLE_LOCK):
00090         """Find out if the lock can be stolen.
00091         
00092         This means:
00093         
00094          - the lock type is stealable; and
00095         
00096          - the object is not marked with INonStealableLock; or
00097          - can_safely_unlock() is true.
00098     
00099         """
    

Here is the caller graph for this function:

def plone.locking.interfaces.ILockable.unlock (   lock_type = STEALABLE_LOCK,
  stealable_only = True 
)
Unlock the object using the given key.

If stealable_only is true, the operation will only have an effect on
objects that are stealable(). Thus, non-stealable locks will need
to pass stealable_only=False to actually get unlocked.

Definition at line 59 of file interfaces.py.

00059 
00060     def unlock(lock_type=STEALABLE_LOCK, stealable_only=True):
00061         """Unlock the object using the given key.
00062         
00063         If stealable_only is true, the operation will only have an effect on
00064         objects that are stealable(). Thus, non-stealable locks will need
00065         to pass stealable_only=False to actually get unlocked.
00066         """
        

Here is the caller graph for this function:


The documentation for this class was generated from the following file: