app/soc/logic/models/presence.py
changeset 850 05e376c84e08
parent 678 b982d9175605
child 864 53101d2fcdee
equal deleted inserted replaced
849:c193ac0ef593 850:05e376c84e08
    39     """
    39     """
    40 
    40 
    41     super(Logic, self).__init__(model, base_model=base_model,
    41     super(Logic, self).__init__(model, base_model=base_model,
    42                                 scope_logic=scope_logic)
    42                                 scope_logic=scope_logic)
    43 
    43 
       
    44   def getToS(self, entity):
       
    45     """Returns the ToS Document of the Presence entity, or None if no ToS.
       
    46 
       
    47     Args:
       
    48       entity:  Presence (or one of its sub-classes) entity that may or may
       
    49         not have a ToS Document attached
       
    50     """
       
    51     if not entity:
       
    52       return None
       
    53 
       
    54     try:
       
    55       tos_doc = entity.tos
       
    56     except db.Error:
       
    57       return None
       
    58 
       
    59     return tos_doc
       
    60 
    44 
    61 
    45 logic = Logic()
    62 logic = Logic()