Added a lock funcion self(), passing only if accessing_obj == accessed_obj. This is potentially useful for Objects who want to lock cmdsets and make them only available to themselves without having to know their id value in the lockstring.

This commit is contained in:
Griatch 2012-05-24 21:44:07 +02:00
parent d3ee5a565b
commit dc67b6b87c

View file

@ -107,6 +107,19 @@ def false(*args, **kwargs):
def none(*args, **kwargs):
return False
def self(accessing_obj, accessed_obj, *args, **kwargs):
"""
Check if accessing_obj is the same as accessed_obj
Usage:
self()
This can be used to lock specifically only to
the same object that the lock is defined on.
"""
return accessing_obj == accessed_obj
def perm(accessing_obj, accessed_obj, *args, **kwargs):
"""
The basic permission-checker. Ignores case.