Changeset 8052 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 6 Apr 2012, 15:27:12 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py
r8008 r8052 80 80 'course1', 'course2', 'course_admitted') and value is not None: 81 81 value = value.code 82 elif name == 'school_grades': 83 value = [eval(entry.to_string()) for entry in value] 82 #elif name == 'school_grades': 83 # value = [eval(entry.to_string()) for entry in value] 84 elif name == 'history': 85 value = value.messages 84 86 return super( 85 87 ApplicantsExporter, self).mangle_value( -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r8044 r8052 303 303 admission. 304 304 """ 305 306 history = Attribute('Object history, a list of messages') 307 state = Attribute('The application state of an applicant') 308 display_fullname = Attribute('The fullname of an applicant') 309 application_date = Attribute('Date of submission, used for export only') 310 password = Attribute('Encrypted password of a applicant') 311 application_number = Attribute('The key under which the record is stored') 312 305 313 applicant_id = schema.TextLine( 306 314 title = _(u'Applicant Id'), … … 373 381 # ) 374 382 375 # 376 # Data to be imported after screening 377 # 383 notice = schema.Text( 384 title = _(u'Notice'), 385 required = False, 386 ) 387 screening_venue = schema.TextLine( 388 title = _(u'Screening Venue'), 389 required = False, 390 ) 378 391 screening_score = schema.Int( 379 392 title = _(u'Screening Score'), 380 required = False,381 )382 screening_venue = schema.TextLine(383 title = _(u'Screening Venue'),384 393 required = False, 385 394 ) … … 389 398 required = False, 390 399 ) 391 notice = schema.Text( 392 title = _(u'Notice'), 393 required = False, 394 ) 395 396 class IApplicantProcessData(IApplicantBaseData): 400 student_id = schema.TextLine( 401 title = _(u'Student Id'), 402 required = False, 403 readonly = False, 404 ) 405 locked = schema.Bool( 406 title = _(u'Form locked'), 407 default = False, 408 ) 409 410 class IApplicant(IApplicantBaseData): 397 411 """An applicant. 398 412 399 Here we add process attributes and methods to the base data. 400 """ 401 402 history = Attribute('Object history, a list of messages') 403 state = Attribute('The application state of an applicant') 404 display_fullname = Attribute('The fullname of an applicant') 405 application_date = Attribute('Date of submission, used for export only') 406 password = Attribute('Encrypted password of a applicant') 407 application_number = Attribute('The key under which the record is stored') 413 This is basically the applicant base data. Here we repeat the 414 fields from base data if we have to set the `required` attribute 415 to True (which is the default). 416 """ 408 417 409 418 def loggerInfo(ob_class, comment): 410 419 """Adds an INFO message to the log file 411 420 """ 412 413 student_id = schema.TextLine(414 title = _(u'Student Id'),415 required = False,416 readonly = False,417 )418 locked = schema.Bool(419 title = _(u'Form locked'),420 default = False,421 )422 423 class IApplicant(IApplicantProcessData):424 """An applicant.425 426 This is basically the applicant base data. Here we repeat the427 fields from base data if we have to set the `required` attribute428 to True (which is the default).429 """430 421 431 422 def createStudent(): -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
r8047 r8052 119 119 applicant.screening_score = 98 120 120 applicant.screening_venue = u'Exam Room' 121 applicant.password = 'any password' 121 122 result_entry = ResultEntry( 122 123 KofaUtils.EXAM_SUBJECTS_DICT.keys()[0], … … 133 134 exporter.export([self.applicant], self.outfile) 134 135 result = open(self.outfile, 'rb').read() 135 self.assertEqual( 136 result, 137 'applicant_id,course1,course2,course_admitted,date_of_birth,' 138 'email,firstname,lastname,lga,middlename,notice,phone,' 139 'reg_number,screening_score,screening_venue,sex\r\n' 140 141 'dp2011_654321,,,,,,Anna,Tester,foreigner,,,,,,,\r\n' 142 ) 136 # The exported records do contain real dates in their 137 # history dict. Therefore we have to split the comparison 138 # into two parts. 139 self.assertTrue( 140 'applicant_id,application_date,application_number,course1,course2,' 141 'course_admitted,date_of_birth,display_fullname,email,firstname,' 142 'history,lastname,lga,locked,middlename,notice,password,phone,' 143 'reg_number,screening_score,screening_venue,sex,state,' 144 'student_id\r\n' 145 'dp2011_654321,,654321,,,,,Anna Tester,,Anna,' 146 in result) 147 self.assertTrue( 148 'Application initialized by system\'],Tester,' 149 'foreigner,0,,,,,,,,,initialized,\r\n' 150 in result) 143 151 return 144 152 … … 150 158 exporter.export([applicant], self.outfile) 151 159 result = open(self.outfile, 'rb').read() 152 self.assertEqual( 153 result, 154 'applicant_id,course1,course2,course_admitted,date_of_birth,' 155 'email,firstname,lastname,lga,middlename,notice,phone,' 156 'reg_number,screening_score,screening_venue,' 157 'sex\r\n' 158 159 'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04,anna@sample.com,' 160 'Anna,Tester,foreigner,M.,"Some notice\nin lines.",' 161 '+234-123-12345,123456,98,Exam Room,f\r\n' 162 ) 160 # The exported records do contain real dates in their 161 # history dict. Therefore we have to split the comparison 162 # into two parts. 163 self.assertTrue( 164 'applicant_id,application_date,application_number,course1,course2,' 165 'course_admitted,date_of_birth,display_fullname,email,firstname,' 166 'history,lastname,lga,locked,middlename,notice,password,phone,' 167 'reg_number,screening_score,screening_venue,sex,state,' 168 'student_id\r\n' 169 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04,' 170 'Anna M. Tester,anna@sample.com,Anna,' 171 in result) 172 self.assertTrue( 173 'Application initialized by system\'],' 174 'Tester,foreigner,0,M.,"Some notice\nin lines.",any password,' 175 '+234-123-12345,123456,98,Exam Room,f,initialized,\r\n' 176 in result) 177 163 178 return 164 179 … … 170 185 exporter.export_all(self.app, self.outfile) 171 186 result = open(self.outfile, 'rb').read() 172 self.assertEqual( 173 result, 174 'applicant_id,course1,course2,course_admitted,date_of_birth,' 175 'email,firstname,lastname,lga,middlename,notice,phone,' 176 'reg_number,screening_score,screening_venue,' 177 'sex\r\n' 178 179 'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04,anna@sample.com,' 180 'Anna,Tester,foreigner,M.,"Some notice\nin lines.",' 181 '+234-123-12345,123456,98,Exam Room,f\r\n' 182 ) 183 return 187 self.assertTrue( 188 'applicant_id,application_date,application_number,course1,course2,' 189 'course_admitted,date_of_birth,display_fullname,email,firstname,' 190 'history,lastname,lga,locked,middlename,notice,password,phone,' 191 'reg_number,screening_score,screening_venue,sex,state,' 192 'student_id\r\n' 193 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04,' 194 'Anna M. Tester,anna@sample.com,Anna,' 195 in result) 196 self.assertTrue( 197 'Application initialized by system\'],' 198 'Tester,foreigner,0,M.,"Some notice\nin lines.",any password,' 199 '+234-123-12345,123456,98,Exam Room,f,initialized,\r\n' 200 in result) 201 return
Note: See TracChangeset for help on using the changeset viewer.