Changeset 5319
- Timestamp:
- 27 Jul 2010, 08:18:51 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/branches/ulif-fasttables/src/waeup/sirp/jambtables/interfaces.py
r5271 r5319 23 23 """ 24 24 from waeup.sirp.interfaces import IWAeUPObject 25 from zc.sourcefactory.basic import BasicSourceFactory 25 26 from zope.interface import Interface 26 27 from zope import schema 27 28 29 class GenderSource(BasicSourceFactory): 30 """A gender source delivers basically a mapping 31 ``{'m': 'male', 'f': 'female'}`` 32 33 Using a source, we make sure that the tokens (which are 34 stored/expected for instance from CSV files) are something one 35 can expect and not cryptic IntIDs. 36 """ 37 def getValues(self): 38 return ['m', 'f'] 39 40 def getToken(self, value): 41 return value[0].lower() 42 43 def getTitle(self, value): 44 if value == 'm': 45 return 'male' 46 if value == 'f': 47 return 'female' 28 48 29 49 class IJAMBDataTable(IWAeUPObject): … … 77 97 required=False, 78 98 ) 79 80 class IApplicant(IWAeUPObject): 81 """An applicant. 82 83 99 100 class IApplicantBaseData(IWAeUPObject): 101 """The data for an applicant. 102 103 This is a base interface with no field (except ``reg_no``) 104 required. For use with importers, forms, etc., please use one of 105 the derived interfaces below, which set more fields to required 106 state, depending on use-case. 84 107 """ 85 108 reg_no = schema.TextLine( … … 88 111 access_code = schema.TextLine( 89 112 title = u'Access Code', 113 required = False, 90 114 ) 91 115 serial = schema.TextLine( … … 95 119 course1 = schema.TextLine( 96 120 title = u'1st Choice Course of Study', 121 required = False, 97 122 ) 98 123 course2 = schema.TextLine( … … 106 131 firstname = schema.TextLine( 107 132 title = u'First Name', 133 required = False, 108 134 ) 109 135 middlenames = schema.TextLine( 110 136 title = u'Middle Names', 137 required = False, 111 138 ) 112 139 lastname = schema.TextLine( 113 140 title = u'Surname/Full Name', 141 required = False, 114 142 ) 115 143 jamb_age = schema.Int( … … 119 147 date_of_birth = schema.Date( 120 148 title = u'Date of Birth', 149 required = False, 121 150 ) 122 151 jamb_state = schema.TextLine( 123 152 title = u'State (provided by JAMB)', 153 required = False, 124 154 ) 125 155 jamb_lga = schema.TextLine( 126 156 title = u'LGA (provided by JAMB)', 157 required = False, 127 158 ) 128 159 lga = schema.TextLine( 129 160 # XXX: should be choice 130 161 title = u'State/LGA (confirmed by applicant)', 162 required = False, 131 163 ) 132 164 sex = schema.Choice( 133 165 title = u'Sex', 134 values = [u'female', u'male'] 166 source = GenderSource(), 167 default = u'm', 168 required = False, 135 169 ) 136 170 email = schema.TextLine( … … 145 179 title = u'Passport Photograph', 146 180 default = True, 181 required = False, 147 182 ) 148 183 aos = schema.TextLine( … … 198 233 fst_sit_fname = schema.TextLine( 199 234 title = u'Full Name', 235 required = False, 200 236 ) 201 237 fst_sit_no = schema.TextLine( … … 212 248 required = False, 213 249 ) 214 #fst_sit_results = schema.TextLine(215 # # XXX: Should be nested list of choices216 # title = u'Results',217 # required = False,218 # )219 220 250 fst_sit_results = schema.List( 221 251 title = u'Results', … … 224 254 title = u'Entries', 225 255 schema = IResultEntry, 256 required = False, 226 257 ) 227 258 ) 228 229 #fst_sit_results = schema.Object(230 # title = u'Results',231 # required = False,232 # schema = IResultEntry,233 # )234 235 #fst_sit_results = schema.Dict(236 # title = u'Results',237 # required = False,238 # key_type = schema.TextLine(239 # title = u'Subject',240 # ),241 # value_type = schema.TextLine(242 # title = u'Score',243 # ),244 # )245 246 #247 # Second sitting data248 #249 259 scd_sit_fname = schema.TextLine( 250 260 title = u'Full Name', 261 required = False, 251 262 ) 252 263 scd_sit_no = schema.TextLine( … … 294 305 application_date = schema.Date( 295 306 title = u'Application Date', 307 required = False, 296 308 ) 297 309 status = schema.TextLine( 298 310 # XXX: should be 'status' type 299 311 title = u'Application Status', 312 required = False, 300 313 ) 301 314 screening_date = schema.Date( 302 315 title = u'Screening Date', 316 required = False, 303 317 ) 304 318 screening_type = schema.TextLine( 305 319 # XXX: schould be choice 306 320 title = u'Screening Type', 321 required = False, 307 322 ) 308 323 screening_score = schema.TextLine( 309 324 title = u'Screening Score', 325 required = False, 310 326 ) 311 327 screening_venue = schema.TextLine( … … 336 352 # XXX: should have sensible default: upcoming session 337 353 title = u'Entry Session', 338 required = True,354 required = False, 339 355 ) 340 356 notice = schema.Text( … … 348 364 import_record_no = schema.TextLine( 349 365 title = u'Import Record No.', 366 required = False, 350 367 ) 351 368 imported_by = schema.TextLine( 352 369 title = u'Imported By', 370 required = False, 353 371 ) 354 372 import_date = schema.Datetime( 355 373 title = u'Import Date', 374 required = False, 356 375 ) 357 376 import_from = schema.TextLine( 358 377 title = u'Import Source', 359 ) 360 378 required = False, 379 ) 380 381 382 class IApplicant(IApplicantBaseData): 383 """An applicant. 384 385 This is basically the applicant base data. Here we repeat the 386 fields from base data only with the `required` attribute of 387 required attributes set to True (which is the default). 388 """ 389 access_code = schema.TextLine( 390 title = u'Access Code', 391 ) 392 course1 = schema.TextLine( 393 title = u'1st Choice Course of Study', 394 ) 395 firstname = schema.TextLine( 396 title = u'First Name', 397 ) 398 middlenames = schema.TextLine( 399 title = u'Middle Names', 400 ) 401 lastname = schema.TextLine( 402 title = u'Surname/Full Name', 403 ) 404 date_of_birth = schema.Date( 405 title = u'Date of Birth', 406 ) 407 jamb_state = schema.TextLine( 408 title = u'State (provided by JAMB)', 409 ) 410 jamb_lga = schema.TextLine( 411 title = u'LGA (provided by JAMB)', 412 ) 413 lga = schema.TextLine( 414 # XXX: should be choice 415 title = u'State/LGA (confirmed by applicant)', 416 ) 417 sex = schema.Choice( 418 title = u'Sex', 419 source = GenderSource(), 420 default = u'm', 421 ) 422 passport = schema.Bool( 423 title = u'Passport Photograph', 424 default = True, 425 ) 426 # 427 # Higher Educational Data 428 # 429 430 # 431 # First sitting data 432 # 433 fst_sit_fname = schema.TextLine( 434 title = u'Full Name', 435 ) 436 437 # 438 # Second sitting data 439 # 440 scd_sit_fname = schema.TextLine( 441 title = u'Full Name', 442 ) 443 # 444 # JAMB scores 445 # 446 447 # 448 # Application Data 449 # 450 application_date = schema.Date( 451 title = u'Application Date', 452 ) 453 status = schema.TextLine( 454 # XXX: should be 'status' type 455 title = u'Application Status', 456 ) 457 screening_date = schema.Date( 458 title = u'Screening Date', 459 ) 460 screening_type = schema.TextLine( 461 # XXX: schould be choice 462 title = u'Screening Type', 463 ) 464 screening_score = schema.TextLine( 465 title = u'Screening Score', 466 ) 467 entry_session = schema.TextLine( 468 # XXX: should be choice 469 # XXX: should have sensible default: upcoming session 470 title = u'Entry Session', 471 ) 472 import_record_no = schema.TextLine( 473 title = u'Import Record No.', 474 ) 475 imported_by = schema.TextLine( 476 title = u'Imported By', 477 ) 478 import_date = schema.Datetime( 479 title = u'Import Date', 480 ) 481 import_from = schema.TextLine( 482 title = u'Import Source', 483 ) 484 485 class IApplicantPDEImportData(IApplicantBaseData): 486 """Data for applicants, that passed PDE screening. 487 488 This data set should be suitable for imports from JAMB tables. It 489 is also basicall the basic applicant data from 490 :class:`IApplicantBaseData` only with the required fields set. 491 492 """ 493 firstname = schema.TextLine( 494 title = u'First Name', 495 required = True, 496 ) 497 middlenames = schema.TextLine( 498 title = u'Middle Names', 499 required = True, 500 ) 501 lastname = schema.TextLine( 502 title = u'Surname/Full Name', 503 required = True, 504 ) 505 date_of_birth = schema.Date( 506 title = u'Date of Birth', 507 required = True, 508 ) 509 jamb_state = schema.TextLine( 510 title = u'State (provided by JAMB)', 511 required = True, 512 ) 513 jamb_lga = schema.TextLine( 514 title = u'LGA (provided by JAMB)', 515 required = True, 516 ) 517 course1 = schema.TextLine( 518 title = u'1st Choice Course of Study', 519 required = True, 520 ) 521 screening_date = schema.Date( 522 title = u'Screening Date', 523 required = True, 524 ) 525 screening_type = schema.TextLine( 526 # XXX: schould be choice 527 title = u'Screening Type', 528 required = True, 529 ) 530 screening_venue = schema.TextLine( 531 title = u'Screening Venue', 532 required = True, 533 ) 534 entry_session = schema.TextLine( 535 # XXX: should be choice 536 # XXX: should have sensible default: upcoming session 537 title = u'Entry Session', 538 required = True, 539 ) 540 361 541 class IApplicantContainer(IWAeUPObject): 362 542 """A container for applicants.
Note: See TracChangeset for help on using the changeset viewer.