Added FuncKeys - locking of objects depending on the result from an arbitrary function.

Added AttrKeys and FlagKeys - locks depending on the value of the unlocker's attribute or if they have a flag set.
Finally I updated @lock to handle all these lock types. There are a large amount of possible configurations though, so more testing is needed.
/Griatch
This commit is contained in:
Griatch 2009-10-12 20:58:15 +00:00
parent 42254355a0
commit 46e2cd3ecb
4 changed files with 225 additions and 89 deletions

View file

@ -235,3 +235,14 @@ class EvenniaBasicObject(object):
return locks.check("EnterLock", pobject)
else:
return True
def lock_func(self, obj):
"""
This is a custom function called by locks with the FuncKey key. Its
return value should match that specified in the lock (so no true/false
lock result is actually determined in here). Default desired return
value is True. Also remember that the comparison in FuncKey is made
using the string representation of the return value, since @lock can
only define string lock criteria.
"""
return False