__init__.py
changeset 231 d740f5f55d30
parent 0 b97547f5f1fa
child 333 c65eccf85895
--- 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)
+