app/soc/logic/models/request.py
changeset 1948 25cd704fdfdf
parent 1308 35b75ffcbb37
child 1954 7aef36e912bb
--- a/app/soc/logic/models/request.py	Fri Mar 20 11:49:12 2009 +0000
+++ b/app/soc/logic/models/request.py	Fri Mar 20 14:04:57 2009 +0000
@@ -58,7 +58,7 @@
     """
 
     return ['scope_path', 'role', 'link_id']
-  
+
   def _onCreate(self, entity):
     """Sends out a message notifying users about the new invite/request.
     """
@@ -73,5 +73,24 @@
 
     super(Logic, self)._onCreate(entity)
 
+  def _updateField(self, entity, entity_properties, name):
+    """Called when the fields of the request are updated.
+
+      - Sends out a message depending on the change of status
+    """
+
+    value = entity_properties[name]
+
+    if name == 'status' and entity.status != value:
+      if value == 'group_accepted':
+       # this is an invite
+        notifications.sendInviteNotification(entity)
+      elif value == 'new':
+        # this is a request
+        # TODO(Lennard) Create a new request message
+        pass
+
+    return super(Logic, self)._updateField(entity, entity_properties, name)
+
 
 logic = Logic()