app/soc/logic/models/host.py
changeset 1062 f7ee38ebfe1c
parent 671 2c02178037ff
child 1085 0afbdd0905ef
equal deleted inserted replaced
1061:09c243461de8 1062:f7ee38ebfe1c
    17 """Host (Model) query functions.
    17 """Host (Model) query functions.
    18 """
    18 """
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
       
    22   '"Lennard de Rijk" <ljvderijk@gmail.com>',
    22   ]
    23   ]
    23 
    24 
    24 
    25 
    25 from soc.logic.models import role
    26 from soc.logic.models import role
    26 from soc.logic.models import sponsor as sponsor_logic
    27 from soc.logic.models import sponsor as sponsor_logic
    40 
    41 
    41     super(Logic, self).__init__(model=model, base_model=base_model,
    42     super(Logic, self).__init__(model=model, base_model=base_model,
    42                                 scope_logic=scope_logic)
    43                                 scope_logic=scope_logic)
    43 
    44 
    44 
    45 
       
    46   def _onCreate(self, entity):
       
    47     """Marks the Sponsor for this Host as active it's state is new.
       
    48     """
       
    49 
       
    50     sponsor_entity = entity.scope
       
    51 
       
    52     if sponsor_entity.state == 'new':
       
    53       # this sponsor is new so mark as active
       
    54       fields = {'state' : 'active'}
       
    55       sponsor_logic.logic.updateEntityProperties(sponsor_entity, fields)
       
    56 
       
    57     # call super
       
    58     super(Logic, self)._onCreate(entity)
       
    59 
       
    60 
    45 logic = Logic()
    61 logic = Logic()