Creating a new host or club_admin will set the group state to active if it's new.
authorLennard de Rijk <ljvderijk@gmail.com>
Thu, 29 Jan 2009 15:54:50 +0000
changeset 1062 f7ee38ebfe1c
parent 1061 09c243461de8
child 1063 f529113e1bc5
Creating a new host or club_admin will set the group state to active if it's new. Patch by: Lennard de Rijk Reviewed by: to-be-reviewed
app/soc/logic/models/club_admin.py
app/soc/logic/models/host.py
--- a/app/soc/logic/models/club_admin.py	Thu Jan 29 15:53:35 2009 +0000
+++ b/app/soc/logic/models/club_admin.py	Thu Jan 29 15:54:50 2009 +0000
@@ -42,5 +42,18 @@
     super(Logic, self).__init__(model=model, base_model=base_model,
                                 scope_logic=scope_logic)
 
+  def _onCreate(self, entity):
+    """Marks the Club for this Club Admin as active it's state is new.
+    """
+
+    club_entity = entity.scope
+
+    if club_entity.state == 'new':
+      # this club is new so mark as active
+      fields = {'state' : 'active'}
+      club_logic.logic.updateEntityProperties(club_entity, fields)
+
+    # call super
+    super(Logic, self)._onCreate(entity)
 
 logic = Logic()
--- a/app/soc/logic/models/host.py	Thu Jan 29 15:53:35 2009 +0000
+++ b/app/soc/logic/models/host.py	Thu Jan 29 15:54:50 2009 +0000
@@ -19,6 +19,7 @@
 
 __authors__ = [
   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
+  '"Lennard de Rijk" <ljvderijk@gmail.com>',
   ]
 
 
@@ -42,4 +43,19 @@
                                 scope_logic=scope_logic)
 
 
+  def _onCreate(self, entity):
+    """Marks the Sponsor for this Host as active it's state is new.
+    """
+
+    sponsor_entity = entity.scope
+
+    if sponsor_entity.state == 'new':
+      # this sponsor is new so mark as active
+      fields = {'state' : 'active'}
+      sponsor_logic.logic.updateEntityProperties(sponsor_entity, fields)
+
+    # call super
+    super(Logic, self)._onCreate(entity)
+
+
 logic = Logic()