- Timestamp:
- 16 Jan 2020, 11:04:43 (5 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/CHANGES.txt
r15920 r15932 4 4 1.6.1.dev0 (unreleased) 5 5 ======================= 6 7 * Reset _curr_stud_id if student could not be created. 6 8 7 9 * Add `TranscriptDataExporter` and reorganize exporter names. -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
r15930 r15932 156 156 and copy applicant data. 157 157 """ 158 site = grok.getSite() 158 159 # Is applicant in the correct state? 159 160 if self.state != 'admitted': … … 164 165 student.reg_number = self.reg_number 165 166 except RegNumNotInSource: 167 # Reset _curr_stud_id 168 site['students']._curr_stud_id -= 1 166 169 return False, _('Registration Number exists.') 167 170 # Has the course_admitted field been properly filled? 168 171 if self.course_admitted is None: 172 # Reset _curr_stud_id 173 site['students']._curr_stud_id -= 1 169 174 return False, _('No course admitted provided.') 170 175 # Set student attributes … … 173 178 setattr(student, item[1], getattr(self, item[0], None)) 174 179 except RequiredMissing, err: 180 site['students']._curr_stud_id -= 1 175 181 return False, 'RequiredMissing: %s' % err 176 182 except: 183 site['students']._curr_stud_id -= 1 177 184 return False, 'Unknown Error' 178 185 # Prove if the certificate still exists … … 180 187 StudentStudyCourse().certificate = self.course_admitted 181 188 except ConstraintNotSatisfied, err: 189 # Reset _curr_stud_id 190 site['students']._curr_stud_id -= 1 182 191 return False, 'ConstraintNotSatisfied: %s' % self.course_admitted.code 183 192 # Finally prove if an application slip can be created … … 186 195 view=view) 187 196 except IOError: 197 site['students']._curr_stud_id -= 1 188 198 return False, _('IOError: Application Slip could not be created.') 189 199 except LayoutError, err: 200 site['students']._curr_stud_id -= 1 190 201 return False, _('Reportlab LayoutError: %s' % err) 191 202 except AttributeError, err: 203 site['students']._curr_stud_id -= 1 192 204 return False, _('Reportlab AttributeError: ${a}', mapping = {'a':err}) 193 205 except: 206 site['students']._curr_stud_id -= 1 194 207 return False, _('Unknown Reportlab error') 195 208 # Add student 196 site = grok.getSite()197 209 site['students'].addStudent(student) 198 210 # Save student_id -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r15833 r15932 700 700 """Create all student objects from applicant data 701 701 in the root container or in a specific applicants container only. 702 Only PortalManagers can do this.702 Only PortalManagers or StudentCreators can do this. 703 703 """ 704 704 #grok.context(IApplicantsContainer) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py
r15036 r15932 63 63 fd = storage.getFile(file_id) 64 64 file_len_orig = len(fd.read()) 65 self.assertEqual(self.app['students']._curr_stud_id, 1000000) 65 66 # Let's try to create the student 66 67 (success, msg) = self.applicant.createStudent() … … 68 69 IWorkflowState(self.applicant).setState('admitted') 69 70 (success, msg) = self.applicant.createStudent() 71 # Current student_id has not changed. 72 self.assertEqual(self.app['students']._curr_stud_id, 1000000) 70 73 self.assertTrue(msg == 'No course admitted provided.') 71 74 self.browser.open(self.manage_path) … … 77 80 self.assertFalse(success) 78 81 self.assertTrue('ConstraintNotSatisfied: CERT1' in msg) 82 # Current student_id has not changed. 83 self.assertEqual(self.app['students']._curr_stud_id, 1000000) 79 84 # Ok, lets add the certificate and try again 80 85 self.app['faculties']['fac1']['dep1'].certificates.addCertificate( … … 85 90 (success, msg) = self.applicant.createStudent() 86 91 self.assertTrue('created' in msg) 92 # Current student_id has not changed. 93 self.assertEqual(self.app['students']._curr_stud_id, 1000001) 87 94 # The applicant is locked 88 95 self.assertTrue(self.applicant.locked) … … 116 123 self.assertTrue(len(pdf) > 0) 117 124 self.assertEqual(pdf[:8], '%PDF-1.4') 118 # Copy te file to samples_dir119 125 path = os.path.join(samples_dir(), 'application_slip.pdf') 120 126 open(path, 'wb').write(pdf)
Note: See TracChangeset for help on using the changeset viewer.