app/soc/logic/models/host.py
changeset 1062 f7ee38ebfe1c
parent 671 2c02178037ff
child 1085 0afbdd0905ef
--- 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()