author | Sylvain Thenault <sylvain.thenault@logilab.fr> |
Fri, 19 Dec 2008 14:53:06 +0100 | |
changeset 231 | d740f5f55d30 |
parent 230 | 6e71adc5ccdd |
child 232 | f1f26070117d |
__init__.py | file | annotate | diff | comparison | revisions |
--- a/__init__.py Fri Dec 19 14:52:42 2008 +0100 +++ b/__init__.py Fri Dec 19 14:53:06 2008 +0100 @@ -297,3 +297,21 @@ 'folders': 'folder', 'tags': 'tag', } + +def neg_role(role): + if role == 'subject': + return 'object' + return 'subject' + +def role(obj): + try: + return obj.role + except AttributeError: + return neg_role(obj.target) + +def target(obj): + try: + return obj.target + except AttributeError: + return neg_role(obj.role) +