1 | ## |
---|
2 | ## interfaces.py |
---|
3 | ## Login : <uli@pu.smp.net> |
---|
4 | ## Started on Sun Jun 27 11:06:23 2010 Uli Fouquet |
---|
5 | ## $Id$ |
---|
6 | ## |
---|
7 | ## Copyright (C) 2010 Uli Fouquet |
---|
8 | ## This program is free software; you can redistribute it and/or modify |
---|
9 | ## it under the terms of the GNU General Public License as published by |
---|
10 | ## the Free Software Foundation; either version 2 of the License, or |
---|
11 | ## (at your option) any later version. |
---|
12 | ## |
---|
13 | ## This program is distributed in the hope that it will be useful, |
---|
14 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | ## GNU General Public License for more details. |
---|
17 | ## |
---|
18 | ## You should have received a copy of the GNU General Public License |
---|
19 | ## along with this program; if not, write to the Free Software |
---|
20 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
21 | ## |
---|
22 | """Interfaces for JAMB data tables and related components. |
---|
23 | """ |
---|
24 | from zope import schema |
---|
25 | from waeup.sirp.interfaces import IWAeUPObject |
---|
26 | from waeup.sirp.applicants.interfaces import ( |
---|
27 | IApplicantBaseData, IApplicantsFormChallenger, |
---|
28 | IApplicantSessionCredentials, |
---|
29 | ) |
---|
30 | |
---|
31 | |
---|
32 | class IJAMBDataRoot(IWAeUPObject): |
---|
33 | """A container that holds JAMB data tables. |
---|
34 | """ |
---|
35 | |
---|
36 | class IApplicantPDEImportData(IApplicantBaseData): |
---|
37 | """Data for applicants, that passed PDE screening. |
---|
38 | |
---|
39 | This data set should be suitable for imports from JAMB tables. It |
---|
40 | is also basicall the basic applicant data from |
---|
41 | :class:`IApplicantBaseData` only with the required fields set. |
---|
42 | |
---|
43 | """ |
---|
44 | firstname = schema.TextLine( |
---|
45 | title = u'First Name', |
---|
46 | required = True, |
---|
47 | ) |
---|
48 | middlenames = schema.TextLine( |
---|
49 | title = u'Middle Names', |
---|
50 | required = True, |
---|
51 | ) |
---|
52 | lastname = schema.TextLine( |
---|
53 | title = u'Surname/Full Name', |
---|
54 | required = True, |
---|
55 | ) |
---|
56 | date_of_birth = schema.Date( |
---|
57 | title = u'Date of Birth', |
---|
58 | required = True, |
---|
59 | ) |
---|
60 | jamb_state = schema.TextLine( |
---|
61 | title = u'State (provided by JAMB)', |
---|
62 | required = True, |
---|
63 | ) |
---|
64 | jamb_lga = schema.TextLine( |
---|
65 | title = u'LGA (provided by JAMB)', |
---|
66 | required = True, |
---|
67 | ) |
---|
68 | course1 = schema.TextLine( |
---|
69 | title = u'1st Choice Course of Study', |
---|
70 | required = True, |
---|
71 | ) |
---|
72 | screening_date = schema.Date( |
---|
73 | title = u'Screening Date', |
---|
74 | required = True, |
---|
75 | ) |
---|
76 | screening_type = schema.TextLine( |
---|
77 | # XXX: schould be choice |
---|
78 | title = u'Screening Type', |
---|
79 | required = True, |
---|
80 | ) |
---|
81 | screening_venue = schema.TextLine( |
---|
82 | title = u'Screening Venue', |
---|
83 | required = True, |
---|
84 | ) |
---|
85 | entry_session = schema.TextLine( |
---|
86 | # XXX: should be choice |
---|
87 | # XXX: should have sensible default: upcoming session |
---|
88 | title = u'Entry Session', |
---|
89 | required = True, |
---|
90 | ) |
---|
91 | |
---|
92 | class IJAMBApplicantsFormChallenger(IApplicantsFormChallenger): |
---|
93 | """A challenger that uses a browser form to collect applicant |
---|
94 | credentials for applicants in JAMB process. |
---|
95 | |
---|
96 | JAMB-screened applicants have to provide an extra registration |
---|
97 | no. provided by JAMB. |
---|
98 | """ |
---|
99 | jamb_reg_no_field = schema.TextLine( |
---|
100 | title = u'JAMB registration no.', |
---|
101 | description = u'''Field of the login page which is looked up for |
---|
102 | the JAMB registration number.''', |
---|
103 | default = u'jamb_reg_no', |
---|
104 | ) |
---|
105 | |
---|
106 | class IJAMBApplicantSessionCredentials(IApplicantSessionCredentials): |
---|
107 | """Interface for storing and accessing JAMB applicant credentials in a |
---|
108 | session. |
---|
109 | """ |
---|
110 | |
---|
111 | def __init__(access_code, jamb_reg_no): |
---|
112 | """Create credentials for JAMB screened applicants.""" |
---|
113 | |
---|
114 | def getJAMBRegNo(): |
---|
115 | """Return the JAMB registration no.""" |
---|