app/soc/logic/models/presence.py
changeset 850 05e376c84e08
parent 678 b982d9175605
child 864 53101d2fcdee
--- a/app/soc/logic/models/presence.py	Tue Jan 20 21:26:34 2009 +0000
+++ b/app/soc/logic/models/presence.py	Tue Jan 20 21:37:30 2009 +0000
@@ -41,5 +41,22 @@
     super(Logic, self).__init__(model, base_model=base_model,
                                 scope_logic=scope_logic)
 
+  def getToS(self, entity):
+    """Returns the ToS Document of the Presence entity, or None if no ToS.
+
+    Args:
+      entity:  Presence (or one of its sub-classes) entity that may or may
+        not have a ToS Document attached
+    """
+    if not entity:
+      return None
+
+    try:
+      tos_doc = entity.tos
+    except db.Error:
+      return None
+
+    return tos_doc
+
 
 logic = Logic()