Ignore:
Timestamp:
13 Feb 2011, 12:02:29 (14 years ago)
Author:
uli
Message:

Move main applicant interfaces to applicants package and try to fix first imports.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/interfaces.py

    r5752 r5753  
    3333from waeup.sirp.interfaces import IWAeUPObject
    3434from waeup.sirp.image.schema import ImageFile
     35from waeup.sirp.applicants.interfaces import IApplicantBaseData
    3536
    36 IMAGE_PATH = os.path.join(
    37     os.path.dirname(waeup.sirp.browser.__file__),
    38     'static'
    39     )
    40 DEFAULT_PASSPORT_IMAGE_MALE = HurryFile(
    41     'passport.jpg',
    42     open(os.path.join(IMAGE_PATH, 'placeholder_m.jpg')).read(),
    43     )
    44 DEFAULT_PASSPORT_IMAGE_FEMALE = HurryFile(
    45     'passport.jpg',
    46     open(os.path.join(IMAGE_PATH, 'placeholder_f.jpg')).read(),
    47     )
    48 
    49 class GenderSource(BasicSourceFactory):
    50     """A gender source delivers basically a mapping
    51        ``{'m': 'male', 'f': 'female'}``
    52 
    53        Using a source, we make sure that the tokens (which are
    54        stored/expected for instance from CSV files) are something one
    55        can expect and not cryptic IntIDs.
    56     """
    57     def getValues(self):
    58         return ['m', 'f']
    59 
    60     def getToken(self, value):
    61         return value[0].lower()
    62        
    63     def getTitle(self, value):
    64         if value == 'm':
    65             return 'male'
    66         if value == 'f':
    67             return 'female'
    6837
    6938class IJAMBDataRoot(IWAeUPObject):
     
    8352        )
    8453
    85 class IApplicantBaseData(IWAeUPObject):
    86     """The data for an applicant.
    87 
    88     This is a base interface with no field (except ``reg_no``)
    89     required. For use with importers, forms, etc., please use one of
    90     the derived interfaces below, which set more fields to required
    91     state, depending on use-case.
    92     """
    93     reg_no = schema.TextLine(
    94         title = u'JAMB Registration Number',
    95         )
    96     access_code = schema.TextLine(
    97         title = u'Access Code',
    98         required = False,
    99         )
    100     serial = schema.TextLine(
    101         title = u'Serial Number',
    102         required = False,
    103         )
    104     course1 = schema.TextLine(
    105         title = u'1st Choice Course of Study',
    106         required = False,
    107         )
    108     course2 = schema.TextLine(
    109         title = u'2nd Choice Course of Study',
    110         required = False,
    111         )
    112     course3 = schema.TextLine(
    113         title = u'3rd Choice Course of Study',
    114         required = False,
    115         )
    116     firstname = schema.TextLine(
    117         title = u'First Name',
    118         required = False,
    119         )
    120     middlenames = schema.TextLine(
    121         title = u'Middle Names',
    122         required = False,
    123         )
    124     lastname = schema.TextLine(
    125         title = u'Surname/Full Name',
    126         required = False,
    127         )
    128     jamb_age = schema.Int(
    129         title = u'Age (provided by JAMB)',
    130         required = False,
    131         )
    132     date_of_birth = schema.Date(
    133         title = u'Date of Birth',
    134         required = False,
    135         )
    136     jamb_state = schema.TextLine(
    137         title = u'State (provided by JAMB)',
    138         required = False,
    139         )
    140     jamb_lga = schema.TextLine(
    141         title = u'LGA (provided by JAMB)',
    142         required = False,
    143         )
    144     lga = schema.TextLine(
    145         # XXX: should be choice
    146         title = u'State/LGA (confirmed by applicant)',
    147         required = False,
    148         )
    149     sex = schema.Choice(
    150         title = u'Sex',
    151         source = GenderSource(),
    152         default = u'm',
    153         required = False,
    154         )
    155     email = schema.TextLine(
    156         title = u'Email',
    157         required = False,
    158         )
    159     phone = schema.TextLine(
    160         title = u'Phone',
    161         required = False,
    162         )
    163     #passport = schema.Bool(
    164     #    title = u'Passport Photograph',
    165     #    default = True,
    166     #    required = False,
    167     #    )
    168     passport = ImageFile(
    169         title = u'Passport Photograph',
    170         default = DEFAULT_PASSPORT_IMAGE_MALE,
    171         required = True,
    172         )
    173     aos = schema.TextLine(
    174         # XXX: should be choice
    175         title = u'Area of Specialisation',
    176         required = False,
    177         )
    178     subj1 = schema.TextLine(
    179         # XXX: should be choice
    180         title = u'1st Choice of Study',
    181         required = False,
    182         )
    183     subj2 = schema.TextLine(
    184         # XXX: should be choice
    185         title = u'2nd Choice of Study',
    186         required = False,
    187         )
    188     subj3 = schema.TextLine(
    189         # XXX: should be choice
    190         title = u'3rd Choice of Study',
    191         required = False,
    192         )
    193     #
    194     # Higher Educational Data
    195     #
    196     hq_matric_no = schema.TextLine(
    197         title = u'Former Matric Number',
    198         required = False,
    199         )
    200     hq_type = schema.TextLine(
    201         title = u'Higher Qualification',
    202         required = False,
    203         )
    204     hq_grade = schema.TextLine(
    205         title = u'Higher Qualification Grade',
    206         required = False,
    207         )
    208     hq_school = schema.TextLine(
    209         title = u'School Attended',
    210         required = False,
    211         )
    212     hq_session = schema.TextLine(
    213         title = u'Session Obtained',
    214         required = False,
    215         )
    216     hq_disc = schema.TextLine(
    217         title = u'Discipline',
    218         required = False,
    219         )
    220     #
    221     # First sitting data
    222     #
    223     fst_sit_fname = schema.TextLine(
    224         title = u'Full Name',
    225         required = False,
    226         )
    227     fst_sit_no = schema.TextLine(
    228         title = u'Exam Number',
    229         required = False,
    230         )
    231     fst_sit_date = schema.Date(
    232         title = u'Exam Date (dd/mm/yyyy)',
    233         required = False,
    234         )
    235     fst_sit_type = schema.TextLine(
    236         # XXX: Should be choice
    237         title = u'Exam Type',
    238         required = False,
    239         )
    240     fst_sit_results = schema.List(
    241         title = u'Results',
    242         required = False,
    243         value_type = schema.Object(
    244             title = u'Entries',
    245             schema = IResultEntry,
    246             required = False,
    247             )
    248         )
    249     scd_sit_fname = schema.TextLine(
    250         title = u'Full Name',
    251         required = False,
    252         )
    253     scd_sit_no = schema.TextLine(
    254         title = u'Exam Number',
    255         required = False,
    256         )
    257     scd_sit_date = schema.Date(
    258         title = u'Exam Date (dd/mm/yyyy)',
    259         required = False,
    260         )
    261     scd_sit_type = schema.TextLine(
    262         # XXX: Should be choice
    263         title = u'Exam Type',
    264         required = False,
    265         )
    266     scd_sit_results = schema.TextLine(
    267         # XXX: Should be nested list of choices
    268         title = u'Results',
    269         required = False,
    270         )
    271     #
    272     # JAMB scores
    273     #
    274     eng_score = schema.TextLine(
    275         title = u"'English' score",
    276         required = False,
    277         )
    278     subj1score = schema.TextLine(
    279         title = u'1st Choice of Study Score',
    280         required = False,
    281         )
    282     subj2score = schema.TextLine(
    283         title = u'2nd Choice of Study Score',
    284         required = False,
    285         )
    286     subj3score = schema.TextLine(
    287         title = u'3rd Choice of Study Score',
    288         required = False,
    289         )
    290     # XXX: Total score???
    291    
    292     #
    293     # Application Data
    294     #
    295     application_date = schema.Date(
    296         title = u'Application Date',
    297         required = False,
    298         )
    299     status = schema.TextLine(
    300         # XXX: should be 'status' type
    301         title = u'Application Status',
    302         required = False,
    303         )
    304     screening_date = schema.Date(
    305         title = u'Screening Date',
    306         required = False,
    307         )
    308     screening_type = schema.TextLine(
    309         # XXX: schould be choice
    310         title = u'Screening Type',
    311         required = False,
    312         )
    313     screening_score = schema.TextLine(
    314         title = u'Screening Score',
    315         required = False,
    316         )
    317     screening_venue = schema.TextLine(
    318         title = u'Screening Venue',
    319         required = False,
    320         )
    321     total_score = schema.TextLine(
    322         title = u'Total Score',
    323         required = False,
    324         )
    325     course_admitted = schema.TextLine(
    326         # XXX: should be choice
    327         title = u'Admitted Course of Study',
    328         required = False,
    329         )
    330     department = schema.TextLine(
    331         # XXX: if we have a course, dept. is not necessary
    332         title = u'Department',
    333         required = False,
    334         )
    335     faculty = schema.TextLine(
    336         # XXX: if we have a course, faculty is not necessary
    337         title = u'Faculty',
    338         required = False,
    339         )
    340     entry_session = schema.TextLine(
    341         # XXX: should be choice, should have sensible default: upcoming session
    342         title = u'Entry Session',
    343         required = False,
    344         )
    345     notice = schema.Text(
    346         title = u'Notice',
    347         required = False,
    348         )
    349     student_id = schema.TextLine(
    350         title = u'Student ID',
    351         required = False,
    352         )
    353     import_record_no = schema.TextLine(
    354         title = u'Import Record No.',
    355         required = False,
    356         )
    357     imported_by = schema.TextLine(
    358         title = u'Imported By',
    359         required = False,
    360         )
    361     import_date = schema.Datetime(
    362         title = u'Import Date',
    363         required = False,
    364         )
    365     import_from = schema.TextLine(
    366         title = u'Import Source',
    367         required = False,
    368         )
    369 
    370    
    371 class IApplicant(IApplicantBaseData):
    372     """An applicant.
    373 
    374     This is basically the applicant base data. Here we repeat the
    375     fields from base data only with the `required` attribute of
    376     required attributes set to True (which is the default).
    377     """
    378     access_code = schema.TextLine(
    379         title = u'Access Code',
    380         )
    381     course1 = schema.TextLine(
    382         title = u'1st Choice Course of Study',
    383         )
    384     firstname = schema.TextLine(
    385         title = u'First Name',
    386         )
    387     middlenames = schema.TextLine(
    388         title = u'Middle Names',
    389         )
    390     lastname = schema.TextLine(
    391         title = u'Surname/Full Name',
    392         )
    393     date_of_birth = schema.Date(
    394         title = u'Date of Birth',
    395         )
    396     jamb_state = schema.TextLine(
    397         title = u'State (provided by JAMB)',
    398         )
    399     jamb_lga = schema.TextLine(
    400         title = u'LGA (provided by JAMB)',
    401         )
    402     lga = schema.TextLine(
    403         # XXX: should be choice
    404         title = u'State/LGA (confirmed by applicant)',
    405         )
    406     sex = schema.Choice(
    407         title = u'Sex',
    408         source = GenderSource(),
    409         default = u'm',
    410         )
    411     #passport = schema.Bool(
    412     #    title = u'Passport Photograph',
    413     #    default = True,
    414     #    )
    415     passport = ImageFile(
    416         title = u'Passport Photograph',
    417         default = DEFAULT_PASSPORT_IMAGE_MALE,
    418         required = True,
    419         )
    420     #
    421     # Higher Educational Data
    422     #
    423 
    424     #
    425     # First sitting data
    426     #
    427     fst_sit_fname = schema.TextLine(
    428         title = u'Full Name',
    429         )
    430 
    431     #
    432     # Second sitting data
    433     #
    434     scd_sit_fname = schema.TextLine(
    435         title = u'Full Name',
    436         )
    437     #
    438     # JAMB scores
    439     #
    440    
    441     #
    442     # Application Data
    443     #
    444     application_date = schema.Date(
    445         title = u'Application Date',
    446         )
    447     status = schema.TextLine(
    448         # XXX: should be 'status' type
    449         title = u'Application Status',
    450         )
    451     screening_date = schema.Date(
    452         title = u'Screening Date',
    453         )
    454     screening_type = schema.TextLine(
    455         # XXX: schould be choice
    456         title = u'Screening Type',
    457         )
    458     screening_score = schema.TextLine(
    459         title = u'Screening Score',
    460         )
    461     entry_session = schema.TextLine(
    462         # XXX: should be choice
    463         # XXX: should have sensible default: upcoming session
    464         title = u'Entry Session',
    465         )
    466     import_record_no = schema.TextLine(
    467         title = u'Import Record No.',
    468         )
    469     imported_by = schema.TextLine(
    470         title = u'Imported By',
    471         )
    472     import_date = schema.Datetime(
    473         title = u'Import Date',
    474         )
    475     import_from = schema.TextLine(
    476         title = u'Import Source',
    477         )
    478 
    479 class IApplicantPDEEditData(IWAeUPObject):
    480     """The data set presented to PDE applicants.
    481     """
    482     reg_no = schema.TextLine(
    483         title = u'JAMB Registration Number',
    484         readonly = True,
    485         )
    486     access_code = schema.TextLine(
    487         title = u'Access Code',
    488         readonly = True,
    489         )
    490     course1 = schema.TextLine(
    491         title = u'1st Choice Course of Study',
    492         readonly = True,
    493         )
    494     course2 = schema.TextLine(
    495         title = u'2nd Choice Course of Study',
    496         required = False,
    497         )
    498     course3 = schema.TextLine(
    499         title = u'3rd Choice Course of Study',
    500         required = False,
    501         )
    502     lastname = schema.TextLine(
    503         title = u'Name',
    504         readonly = True,
    505         )
    506     jamb_age = schema.Int(
    507         title = u'Age',
    508         readonly = True,
    509         )
    510     date_of_birth = schema.Date(
    511         title = u'Date of Birth',
    512         required = True,
    513         )
    514     jamb_state = schema.TextLine(
    515         title = u'State (provided by JAMB)',
    516         readonly = True,
    517         )
    518     jamb_lga = schema.TextLine(
    519         title = u'LGA (provided by JAMB)',
    520         readonly = True,
    521         )
    522     lga = schema.TextLine(
    523         # XXX: should be choice
    524         title = u'State/LGA (confirmed by applicant)',
    525         required = False,
    526         )
    527     email = schema.TextLine(
    528         title = u'Email',
    529         required = False,
    530         )
    531     phone = schema.TextLine(
    532         title = u'Phone',
    533         required = False,
    534         )
    535     aos = schema.TextLine(
    536         # XXX: should be choice
    537         title = u'Area of Specialisation',
    538         required = False,
    539         )
    540     subj1 = schema.TextLine(
    541         # XXX: should be choice
    542         title = u'1st Choice of Study',
    543         readonly = True,
    544         )
    545     subj2 = schema.TextLine(
    546         # XXX: should be choice
    547         title = u'2nd Choice of Study',
    548         required = False,
    549         )
    550     subj3 = schema.TextLine(
    551         # XXX: should be choice
    552         title = u'3rd Choice of Study',
    553         required = False,
    554         )
    555    
    556     #
    557     # Application Data
    558     #
    559     application_date = schema.Date(
    560         title = u'Application Date',
    561         readonly = True,
    562         )
    563     status = schema.TextLine(
    564         # XXX: should be 'status' type
    565         title = u'Application Status',
    566         readonly = True,
    567         )
    568     screening_date = schema.Date(
    569         title = u'Screening Date',
    570         readonly = True,
    571         )
    572     #passport = schema.Bool(
    573     #    title = u'Passport Photograph',
    574     #    default = True,
    575     #    required = False,
    576     #    ),
    577     #passport = schema.Bytes(
    578     #    title = u'Passport Photograph',
    579     #    required = True,
    580     #    )
    581     #passport = schema.Object(
    582     #    title = u'Passport Photograph',
    583     #    required = True,
    584     #    schema = IImage)
    585     passport = ImageFile(
    586         title = u'Passport Photograph',
    587         default = DEFAULT_PASSPORT_IMAGE_MALE,
    588         required = True,
    589         )
    59054
    59155class IApplicantPDEImportData(IApplicantBaseData):
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/jambtables/jambtables.py

    r5743 r5753  
    3636from waeup.sirp.interfaces import IWAeUPSIRPPluggable
    3737from waeup.sirp.applicants.jambtables.interfaces import (
    38     IJAMBDataTable, IJAMBDataRoot
     38    IJAMBDataRoot
    3939    )
    4040
Note: See TracChangeset for help on using the changeset viewer.