- Timestamp:
- 27 Jun 2012, 14:01:32 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
r8742 r8843 27 27 from zope.securitypolicy.interfaces import IPrincipalRoleManager 28 28 from zope.interface import implementedBy 29 from zope.schema.interfaces import RequiredMissing 29 from zope.schema.interfaces import RequiredMissing, ConstraintNotSatisfied 30 30 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 31 31 from waeup.kofa.app import University … … 37 37 from waeup.kofa.interfaces import MessageFactory as _ 38 38 from waeup.kofa.students.vocabularies import RegNumNotInSource 39 from waeup.kofa.students.studycourse import StudentStudyCourse 39 40 from waeup.kofa.utils.helpers import attrs_to_fields 40 41 from waeup.kofa.applicants.interfaces import IApplicant, IApplicantEdit … … 119 120 if self.course_admitted is None: 120 121 return False, _('No course admitted provided.') 121 # Add student object122 # Set student attributes 122 123 try: 123 124 for name in self.create_names: … … 125 126 except RequiredMissing, err: 126 127 return False, _('RequiredMissing: %s' % err) 128 except: 129 return False, _('Error: %s' % err) 130 # Finally prove if the certificate still exists 131 try: 132 StudentStudyCourse().certificate = self.course_admitted 133 except ConstraintNotSatisfied, err: 134 return False, _('ConstraintNotSatisfied: %s' % self.course_admitted.code) 135 # Add student 127 136 site = grok.getSite() 128 137 site['students'].addStudent(student) 129 self.student_id = student.student_id130 138 IWorkflowInfo(self).fireTransition('create') 131 139 IWorkflowInfo(student).fireTransition('admit') 132 133 140 # Set password 134 141 IUserAccount(student).setPassword(self.application_number) 135 136 142 # Save the certificate and set session attributes 137 143 student['studycourse'].certificate = self.course_admitted … … 143 149 # Update the catalog 144 150 notify(grok.ObjectModifiedEvent(student)) 145 146 151 # Save application slip 147 152 self._createApplicationPDF(student, view=view) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py
r8667 r8843 67 67 self.browser.getControl(name="form.course_admitted").value = ['CERT1'] 68 68 self.browser.getControl("Save").click() 69 # Maybe the certificate has meanwhile been removed 70 del self.app['faculties']['fac1']['dep1'].certificates['CERT1'] 71 (success, msg) = self.applicant.createStudent() 72 self.assertFalse(success) 73 self.assertTrue('ConstraintNotSatisfied: CERT1' in msg) 74 # Ok, lets add the certificate and try again 75 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( 76 self.certificate) 69 77 (success, msg) = self.applicant.createStudent() 70 78 self.assertTrue('created' in msg)
Note: See TracChangeset for help on using the changeset viewer.