Changeset 10200
- Timestamp:
- 22 May 2013, 15:59:20 (11 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/students/browser.py
r10025 r10200 46 46 from waeup.uniben.interfaces import MessageFactory as _ 47 47 48 class CustomStudentTriggerTransitionFormPage(StudentTriggerTransitionFormPage):49 """ View to manage student base data50 """51 52 def getTransitions(self):53 """Return a list of dicts of allowed transition ids and titles.54 55 Each list entry provides keys ``name`` and ``title`` for56 internal name and (human readable) title of a single57 transition.58 """59 wf_info = IWorkflowInfo(self.context)60 allowed_transitions = [t for t in wf_info.getManualTransitions()61 if not t[0].startswith('pay')]62 if self.context.is_postgrad and not self.context.is_special_postgrad:63 allowed_transitions = [t for t in allowed_transitions64 if not t[0] in FORBIDDEN_POSTGRAD_TRANS]65 return [dict(name='', title=_('No transition'))] +[66 dict(name=x, title=y) for x, y in allowed_transitions]67 68 48 class CustomOnlinePaymentDisplayFormPage(NigeriaOnlinePaymentDisplayFormPage): 69 49 """ Page to view an online payment ticket … … 163 143 """ 164 144 grok.template('studyleveleditpage') 165 166 def _registerCourses(self, **data):167 """ This customized version does allow 'special postgraduate'168 students to register their courses.169 """170 if self.context.student.is_postgrad and \171 not self.context.student.is_special_postgrad:172 self.flash(_(173 "You are a postgraduate student, "174 "your course list can't bee registered."))175 self.redirect(self.url(self.context))176 return177 students_utils = getUtility(IStudentsUtils)178 max_credits = students_utils.maxCredits(self.context)179 if self.context.total_credits > max_credits:180 self.flash(_('Maximum credits of ${a} exceeded.',181 mapping = {'a':max_credits}))182 return183 IWorkflowInfo(self.context.student).fireTransition(184 'register_courses')185 self.flash(_('Course list has been registered.'))186 self.redirect(self.url(self.context))187 return188 145 189 146 class CustomStudyLevelDisplayFormPage(StudyLevelDisplayFormPage): -
main/waeup.uniben/trunk/src/waeup/uniben/students/student.py
r9251 r10200 35 35 grok.provides(ICustomStudent) 36 36 37 @property38 def is_special_postgrad(self):39 is_special_postgrad = getattr(40 self.get('studycourse', None), 'is_special_postgrad', False)41 return is_special_postgrad42 43 37 44 38 # Set all attributes of Student required in IStudent as field -
main/waeup.uniben/trunk/src/waeup/uniben/students/studycourse.py
r9360 r10200 48 48 return self.certificate.study_mode.startswith('special_pg') 49 49 50 @property51 def next_session_allowed(self):52 state = self.student.state53 certificate = getattr(self, 'certificate', None)54 if certificate == None:55 return False56 if state == CLEARED:57 return True58 cond0 = state == RETURNING59 cond1 = self.current_verdict in (60 'A','B','C','F','J','L','M','N','O','X','Z')61 cond2 = self.current_level in (0, 100)62 cond3 = certificate.study_mode.startswith('de') and \63 self.current_level == 20064 cond4 = certificate.study_mode.startswith('ph') and \65 self.current_level == 30066 if cond0 and (cond1 or cond2 or cond3 or cond4):67 return True68 cond5 = self.is_postgrad69 cond6 = state == PAID70 cond7 = self.is_special_postgrad71 if cond5 and cond6 and not cond7:72 return True73 return False74 75 50 CustomStudentStudyCourse = attrs_to_fields(CustomStudentStudyCourse) 76 51
Note: See TracChangeset for help on using the changeset viewer.