Changeset 13080 for main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Timestamp:
- 20 Jun 2015, 07:55:18 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/applicant.py
r13073 r13080 84 84 @property 85 85 def container_code(self): 86 return self.__parent__.code 86 try: 87 code = self.__parent__.code 88 except AttributeError: # in unit tests 89 return 90 return code 87 91 88 92 @property 89 93 def translated_state(self): 90 return application_states_dict[self.state] 94 try: 95 state = application_states_dict[self.state] 96 except LookupError: # in unit tests 97 return 98 return state 91 99 92 100 @property … … 97 105 @property 98 106 def special(self): 99 return self.__parent__.prefix.startswith('special') 107 try: 108 special = self.__parent__.prefix.startswith('special') 109 except AttributeError: # in unit tests 110 return 111 return special 100 112 101 113 @property -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/export.py
r12865 r13080 79 79 grok.name('applicants') 80 80 81 fields = tuple(sorted(IApplicantBaseData.names())) + ('container_code',) 81 fields = tuple(sorted(iface_names(IApplicantBaseData))) + ( 82 'password', 'state', 'history', 'container_code', 'application_number', 83 'display_fullname', 'application_date') 82 84 title = _(u'Applicants') 83 85 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py
r13077 r13080 327 327 state, depending on use-case. 328 328 """ 329 state = Attribute('Application state of an applicant') 330 history = Attribute('Object history, a list of messages') 331 display_fullname = Attribute('The fullname of an applicant') 332 application_number = Attribute('The key under which the record is stored') 333 container_code = Attribute('Code of the parent container') 334 translated_state = Attribute('Real name of the application state') 335 special = Attribute('True if special application') 336 application_number = Attribute('The key under which the record is stored') 337 338 application_date = Attribute('UTC datetime of submission, used for export only') 339 password = Attribute('Encrypted password of a applicant') 340 341 342 suspended = schema.Bool( 343 title = _(u'Account suspended'), 344 default = False, 345 required = False, 346 ) 347 348 applicant_id = schema.TextLine( 349 title = _(u'Applicant Id'), 350 required = False, 351 readonly = False, 352 ) 353 354 reg_number = TextLineChoice( 355 title = _(u'Registration Number'), 356 readonly = False, 357 required = True, 358 source = contextual_reg_num_source, 359 ) 360 361 firstname = schema.TextLine( 362 title = _(u'First Name'), 363 required = True, 364 ) 365 366 middlename = schema.TextLine( 367 title = _(u'Middle Name'), 368 required = False, 369 ) 370 371 lastname = schema.TextLine( 372 title = _(u'Last Name (Surname)'), 373 required = True, 374 ) 375 376 date_of_birth = FormattedDate( 377 title = _(u'Date of Birth'), 378 required = False, 379 show_year = True, 380 ) 381 382 sex = schema.Choice( 383 title = _(u'Sex'), 384 source = GenderSource(), 385 required = True, 386 ) 387 388 email = schema.ASCIILine( 389 title = _(u'Email Address'), 390 required = False, 391 constraint=validate_email, 392 ) 393 394 phone = PhoneNumber( 395 title = _(u'Phone'), 396 description = u'', 397 required = False, 398 ) 399 400 course1 = schema.Choice( 401 title = _(u'1st Choice Course of Study'), 402 source = AppCatCertificateSource(), 403 required = True, 404 ) 405 406 course2 = schema.Choice( 407 title = _(u'2nd Choice Course of Study'), 408 source = AppCatCertificateSource(), 409 required = False, 410 ) 411 412 #school_grades = schema.List( 413 # title = _(u'School Grades'), 414 # value_type = ResultEntryField(), 415 # required = False, 416 # default = [], 417 # ) 418 419 notice = schema.Text( 420 title = _(u'Notice'), 421 required = False, 422 ) 423 student_id = schema.TextLine( 424 title = _(u'Student Id'), 425 required = False, 426 readonly = False, 427 ) 428 course_admitted = schema.Choice( 429 title = _(u'Admitted Course of Study'), 430 source = CertificateSource(), 431 required = False, 432 ) 433 locked = schema.Bool( 434 title = _(u'Form locked'), 435 default = False, 436 required = False, 437 ) 438 439 special_application = schema.Choice( 440 title = _(u'Special Application'), 441 source = SpecialApplicationSource(), 442 required = False, 443 ) 444 445 class IApplicant(IApplicantBaseData): 446 """This is basically the applicant base data. Here we repeat the 447 fields from base data if we have to set the `required` attribute 448 to True (which is the default). 449 """ 450 451 def writeLogMessage(view, comment): 452 """Adds an INFO message to the log file 453 """ 454 455 def createStudent(): 456 """Create a student object from applicatnt data 457 and copy applicant object. 458 """ 459 460 class ISpecialApplicant(IApplicantBase): 461 """This reduced interface is for former students or students who are not 462 student users of the portal but have to pay supplementary fees. 463 464 This interface is used in browser components only. Thus we can't add 465 fields here to the regular IApplicant interface here. We can 466 only 'customize' fields. 467 """ 329 468 history = Attribute('Object history, a list of messages') 330 469 state = Attribute('The application state of an applicant') … … 340 479 ) 341 480 342 applicant_id = schema.TextLine(343 title = _(u'Applicant Id'),344 required = False,345 readonly = False,346 )347 348 reg_number = TextLineChoice(349 title = _(u'Registration Number'),350 readonly = False,351 required = True,352 source = contextual_reg_num_source,353 )354 355 firstname = schema.TextLine(356 title = _(u'First Name'),357 required = True,358 )359 360 middlename = schema.TextLine(361 title = _(u'Middle Name'),362 required = False,363 )364 365 lastname = schema.TextLine(366 title = _(u'Last Name (Surname)'),367 required = True,368 )369 370 date_of_birth = FormattedDate(371 title = _(u'Date of Birth'),372 required = False,373 show_year = True,374 )375 376 sex = schema.Choice(377 title = _(u'Sex'),378 source = GenderSource(),379 required = True,380 )381 382 email = schema.ASCIILine(383 title = _(u'Email Address'),384 required = False,385 constraint=validate_email,386 )387 388 phone = PhoneNumber(389 title = _(u'Phone'),390 description = u'',391 required = False,392 )393 394 course1 = schema.Choice(395 title = _(u'1st Choice Course of Study'),396 source = AppCatCertificateSource(),397 required = True,398 )399 400 course2 = schema.Choice(401 title = _(u'2nd Choice Course of Study'),402 source = AppCatCertificateSource(),403 required = False,404 )405 406 #school_grades = schema.List(407 # title = _(u'School Grades'),408 # value_type = ResultEntryField(),409 # required = False,410 # default = [],411 # )412 413 notice = schema.Text(414 title = _(u'Notice'),415 required = False,416 )417 student_id = schema.TextLine(418 title = _(u'Student Id'),419 required = False,420 readonly = False,421 )422 course_admitted = schema.Choice(423 title = _(u'Admitted Course of Study'),424 source = CertificateSource(),425 required = False,426 )427 locked = schema.Bool(428 title = _(u'Form locked'),429 default = False,430 required = False,431 )432 433 special_application = schema.Choice(434 title = _(u'Special Application'),435 source = SpecialApplicationSource(),436 required = False,437 )438 439 class IApplicant(IApplicantBaseData):440 """This is basically the applicant base data. Here we repeat the441 fields from base data if we have to set the `required` attribute442 to True (which is the default).443 """444 445 def writeLogMessage(view, comment):446 """Adds an INFO message to the log file447 """448 449 def createStudent():450 """Create a student object from applicatnt data451 and copy applicant object.452 """453 454 class ISpecialApplicant(IApplicantBase):455 """This reduced interface is for former students or students who are not456 student users of the portal but have to pay supplementary fees.457 458 This interface is used in browser components only. Thus we can't add459 fields here to the regular IApplicant interface here. We can460 only 'customize' fields.461 """462 history = Attribute('Object history, a list of messages')463 state = Attribute('The application state of an applicant')464 display_fullname = Attribute('The fullname of an applicant')465 application_date = Attribute('UTC datetime of submission, used for export only')466 password = Attribute('Encrypted password of a applicant')467 application_number = Attribute('The key under which the record is stored')468 469 suspended = schema.Bool(470 title = _(u'Account suspended'),471 default = False,472 required = False,473 )474 475 481 locked = schema.Bool( 476 482 title = _(u'Form locked'), -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
r12394 r13080 139 139 # into two parts. 140 140 self.assertTrue( 141 'applicant_id,application_date,application_number,course1,course2,' 142 'course_admitted,date_of_birth,display_fullname,email,firstname,' 143 'history,lastname,locked,middlename,notice,password,phone,' 144 'reg_number,sex,special_application,state,' 145 'student_id,suspended,container_code\r\n' 146 'dp2011_654321,,654321,,,,,Anna Tester,,Anna,' 147 in result) 148 self.assertTrue( 149 'Application initialized by system\'],Tester,' 150 '0,,,,,,,,initialized,,0,dp2011\r\n' 141 'applicant_id,course1,course2,course_admitted,date_of_birth,' 142 'email,firstname,lastname,locked,middlename,notice,phone,' 143 'reg_number,sex,special_application,student_id,suspended,' 144 'password,state,history,container_code,application_number,' 145 'display_fullname,application_date\r\n' 146 'dp2011_654321,,,,,,Anna,Tester,0' 147 in result) 148 self.assertTrue( 149 'Application initialized by system\'],dp2011,654321,Anna Tester' 151 150 in result) 152 151 return … … 163 162 # into two parts. 164 163 self.assertTrue( 165 'applicant_id,application_date,application_number,course1,course2,' 166 'course_admitted,date_of_birth,display_fullname,email,firstname,' 167 'history,lastname,locked,middlename,notice,password,phone,' 168 'reg_number,sex,special_application,state,' 169 'student_id,suspended,container_code\r\n' 170 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 171 'Anna M. Tester,anna@sample.com,Anna,' 172 in result) 173 self.assertTrue( 174 'Application initialized by system\'],' 175 'Tester,0,M.,"Some notice\nin lines.",any password,' 176 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 164 'applicant_id,course1,course2,course_admitted,date_of_birth,' 165 'email,firstname,lastname,locked,middlename,notice,phone,' 166 'reg_number,sex,special_application,student_id,suspended,' 167 'password,state,history,container_code,application_number,' 168 'display_fullname,application_date\r\n' 169 'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,' 170 'anna@sample.com,Anna,Tester,' 171 in result) 172 self.assertTrue( 173 'Application initialized by system\'],dp2011,654321,' 174 'Anna M. Tester,\r\n' 177 175 in result) 178 176 … … 187 185 result = open(self.outfile, 'rb').read() 188 186 self.assertTrue( 189 'applicant_id,application_date,application_number,course1,course2,' 190 'course_admitted,date_of_birth,display_fullname,email,firstname,' 191 'history,lastname,locked,middlename,notice,password,phone,' 192 'reg_number,sex,special_application,state,' 193 'student_id,suspended,container_code\r\n' 194 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 195 'Anna M. Tester,anna@sample.com,Anna,' 196 in result) 197 self.assertTrue( 198 'Application initialized by system\'],' 199 'Tester,0,M.,"Some notice\nin lines.",any password,' 200 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 187 'applicant_id,course1,course2,course_admitted,date_of_birth,' 188 'email,firstname,lastname,locked,middlename,notice,phone,' 189 'reg_number,sex,special_application,student_id,suspended,' 190 'password,state,history,container_code,application_number,' 191 'display_fullname,application_date\r\n' 192 'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,' 193 'anna@sample.com,Anna,Tester,' 194 in result) 195 self.assertTrue( 196 'Application initialized by system\'],dp2011,654321,' 197 'Anna M. Tester,\r\n' 201 198 in result) 202 199 return … … 209 206 result = open(self.outfile, 'rb').read() 210 207 self.assertTrue( 211 'applicant_id,application_date,application_number,course1,course2,' 212 'course_admitted,date_of_birth,display_fullname,email,firstname,' 213 'history,lastname,locked,middlename,notice,password,phone,' 214 'reg_number,sex,special_application,state,' 215 'student_id,suspended,container_code\r\n' 216 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 217 'Anna M. Tester,anna@sample.com,Anna,' 218 in result) 219 self.assertTrue( 220 'Application initialized by system\'],' 221 'Tester,0,M.,"Some notice\nin lines.",any password,' 222 '+234-123-12345#,123456,f,,initialized,,0,dp2011\r\n' 208 'applicant_id,course1,course2,course_admitted,date_of_birth,' 209 'email,firstname,lastname,locked,middlename,notice,phone,' 210 'reg_number,sex,special_application,student_id,suspended,' 211 'password,state,history,container_code,application_number,' 212 'display_fullname,application_date\r\n' 213 'dp2011_654321,CERT1,CERT1,CERT1,1981-02-04#,' 214 'anna@sample.com,Anna,Tester,' 215 in result) 216 self.assertTrue( 217 'Application initialized by system\'],dp2011,654321,' 218 'Anna M. Tester,\r\n' 223 219 in result) 224 220 # In empty container no applicants are exported … … 230 226 result = open(self.outfile, 'rb').read() 231 227 self.assertTrue( 232 'applicant_id, application_date,application_number,course1,'233 ' course2,course_admitted,date_of_birth,display_fullname,email,'234 ' firstname,history,lastname,locked,middlename,notice,password,'235 'p hone,reg_number,sex,special_application,state,student_id,'236 ' suspended,container_code\r\n'237 in result) 238 return 228 'applicant_id,course1,course2,course_admitted,date_of_birth,' 229 'email,firstname,lastname,locked,middlename,notice,phone,' 230 'reg_number,sex,special_application,student_id,suspended,' 231 'password,state,history,container_code,application_number,' 232 'display_fullname,application_date\r\n' 233 in result) 234 return
Note: See TracChangeset for help on using the changeset viewer.