Merge pull request #2228 from strikaco/lockfix

Adds appropriate object checking to objtag lockfunc
This commit is contained in:
Griatch 2020-10-12 19:35:25 +02:00 committed by GitHub
commit 199cb5682c

View file

@ -539,6 +539,8 @@ def objtag(accessing_obj, accessed_obj, *args, **kwargs):
Only true if accessed_obj has the specified tag and optional
category.
"""
if hasattr(accessed_obj, "obj"):
accessed_obj = accessed_obj.obj
tagkey = args[0] if args else None
category = args[1] if len(args) > 1 else None
return bool(accessed_obj.tags.get(tagkey, category=category))
@ -555,6 +557,8 @@ def inside(accessing_obj, accessed_obj, *args, **kwargs):
want also nested objects to pass the lock, use the `insiderecursive`
lockfunc.
"""
if hasattr(accessed_obj, "obj"):
accessed_obj = accessed_obj.obj
return accessing_obj.location == accessed_obj