app/soc/views/models/student_project.py
changeset 2360 e389d26949db
parent 2330 068540d91bde
child 2573 f09f317769c4
equal deleted inserted replaced
2359:d4de17ab9a1f 2360:e389d26949db
    73     rights['manage'] = [('checkHasActiveRoleForScope',
    73     rights['manage'] = [('checkHasActiveRoleForScope',
    74                          org_admin_logic),
    74                          org_admin_logic),
    75         ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed']])]
    75         ('checkStudentProjectHasStatus', [['accepted', 'mid_term_passed']])]
    76     rights['manage_overview'] = [('checkHasActiveRoleForScope',
    76     rights['manage_overview'] = [('checkHasActiveRoleForScope',
    77                          org_admin_logic)]
    77                          org_admin_logic)]
    78     # TODO lack of better name here!
    78     # TODO: lack of better name here!
    79     rights['st_edit'] = ['checkIsMyStudentProject',
    79     rights['st_edit'] = ['checkIsMyStudentProject',
    80         ('checkStudentProjectHasStatus',
    80         ('checkStudentProjectHasStatus',
    81             [['accepted', 'mid_term_passed', 'passed']])
    81             [['accepted', 'mid_term_passed', 'passed']])
    82         ]
    82         ]
    83 
    83 
   242       fields = {'link_id': get_dict['remove'],
   242       fields = {'link_id': get_dict['remove'],
   243                 'scope': entity.scope}
   243                 'scope': entity.scope}
   244       mentor = mentor_logic.logic.getForFields(fields, unique=True)
   244       mentor = mentor_logic.logic.getForFields(fields, unique=True)
   245 
   245 
   246       additional_mentors = entity.additional_mentors
   246       additional_mentors = entity.additional_mentors
       
   247       # pylint: disable-msg=E1103
   247       if additional_mentors and mentor.key() in additional_mentors:
   248       if additional_mentors and mentor.key() in additional_mentors:
   248         # remove the mentor from the additional mentors list
   249         # remove the mentor from the additional mentors list
   249         additional_mentors.remove(mentor.key())
   250         additional_mentors.remove(mentor.key())
   250         fields = {'additional_mentors': additional_mentors}
   251         fields = {'additional_mentors': additional_mentors}
   251         project_logic.updateEntityProperties(entity, fields)
   252         project_logic.updateEntityProperties(entity, fields)
   409     # update the project with the assigned mentor
   410     # update the project with the assigned mentor
   410     fields = {'mentor': mentor}
   411     fields = {'mentor': mentor}
   411 
   412 
   412     additional_mentors = entity.additional_mentors
   413     additional_mentors = entity.additional_mentors
   413 
   414 
       
   415     # pylint: disable-msg=E1103
   414     if additional_mentors and mentor.key() in additional_mentors:
   416     if additional_mentors and mentor.key() in additional_mentors:
   415       # remove the mentor that is now becoming the primary mentor
   417       # remove the mentor that is now becoming the primary mentor
   416       additional_mentors.remove(mentor.key())
   418       additional_mentors.remove(mentor.key())
   417       fields['additional_mentors'] = additional_mentors
   419       fields['additional_mentors'] = additional_mentors
   418 
   420 
   451               'scope': entity.scope,
   453               'scope': entity.scope,
   452               'status': 'active'}
   454               'status': 'active'}
   453     mentor = mentor_logic.logic.getForFields(fields, unique=True)
   455     mentor = mentor_logic.logic.getForFields(fields, unique=True)
   454 
   456 
   455     # add this mentor to the additional mentors
   457     # add this mentor to the additional mentors
       
   458     # pylint: disable-msg=E1103
   456     if not entity.additional_mentors:
   459     if not entity.additional_mentors:
   457       additional_mentors = [mentor.key()]
   460       additional_mentors = [mentor.key()]
   458     else:
   461     else:
   459       additional_mentors = additional_mentors.append(mentor.key())
   462       additional_mentors = additional_mentors.append(mentor.key())
   460 
   463