app/soc/logic/models/survey.py
changeset 2466 70854ec7909d
parent 2462 2d5d2961f774
child 2467 f46cff8d676b
equal deleted inserted replaced
2465:037a7e79a635 2466:70854ec7909d
   460     """Defines the name, key_name and model for this entity.
   460     """Defines the name, key_name and model for this entity.
   461     """
   461     """
   462 
   462 
   463     super(GradingProjectLogic, self).__init__(model=model,
   463     super(GradingProjectLogic, self).__init__(model=model,
   464                                               base_model=base_model,
   464                                               base_model=base_model,
   465 <<<<<<< local
       
   466                                               scope_logic=scope_logic)
   465                                               scope_logic=scope_logic)
   467 
       
   468 class ResultsLogic(work.Logic):
       
   469   """Logic methods for the Survey model
       
   470   """
       
   471 
       
   472   def __init__(self, model=SurveyRecord,
       
   473                base_model=Work, scope_logic=linkable_logic):
       
   474     """Defines the name, key_name and model for this entity.
       
   475     """
       
   476 
       
   477     super(ResultsLogic, self).__init__(model=model, base_model=base_model,
       
   478                                 scope_logic=scope_logic)
       
   479 =======
       
   480                                               scope_logic=scope_logic,
       
   481                                               record_logic=record_logic)
       
   482 >>>>>>> other
       
   483 
       
   484   def getKeyValuesFromEntity(self, entity):
       
   485     """See base.Logic.getKeyNameValues.
       
   486     """
       
   487 
       
   488     return [entity.prefix, entity.scope_path, entity.link_id]
       
   489 
       
   490   def getKeyValuesFromFields(self, fields):
       
   491     """See base.Logic.getKeyValuesFromFields.
       
   492     """
       
   493 
       
   494     return [fields['prefix'], fields['scope_path'], fields['link_id']]
       
   495 
       
   496   def getKeyFieldNames(self):
       
   497     """See base.Logic.getKeyFieldNames.
       
   498     """
       
   499 
       
   500     return ['prefix', 'scope_path', 'link_id']
       
   501 
       
   502   def isDeletable(self, entity):
       
   503     """See base.Logic.isDeletable.
       
   504     """
       
   505 
       
   506     return not entity.home_for
       
   507 
       
   508   def _updateField(self, entity, entity_properties, name):
       
   509     """Special logic for role. If state changes to active we flush the sidebar.
       
   510     """
       
   511 
       
   512     value = entity_properties[name]
       
   513 
       
   514     if (name == 'is_featured') and (entity.is_featured != value):
       
   515       sidebar.flush()
       
   516 
       
   517     home_for = entity.home_for
       
   518     if (name != 'home_for') and home_for:
       
   519       home.flush(home_for)
       
   520     return True
       
   521 
   466 
   522 
   467 
   523 logic = Logic()
   468 logic = Logic()
   524 project_logic = ProjectLogic()
   469 project_logic = ProjectLogic()
   525 grading_logic = GradingProjectLogic()
   470 grading_logic = GradingProjectLogic()
   526 results_logic = ResultsLogic()