1 | ## |
---|
2 | ## interfaces.py |
---|
3 | from zope.interface import Interface, Attribute |
---|
4 | from zope import schema |
---|
5 | from waeup.sirp.interfaces import IWAeUPObject |
---|
6 | from waeup.sirp.university.vocabularies import study_modes |
---|
7 | from waeup.sirp.students.vocabularies import ( |
---|
8 | year_range, lgas_vocab, CertificateSource, GenderSource, |
---|
9 | entry_session_vocab, study_levels, verdicts, |
---|
10 | ) |
---|
11 | |
---|
12 | class IStudentsContainer(IWAeUPObject): |
---|
13 | """An students container contains university students. |
---|
14 | |
---|
15 | """ |
---|
16 | |
---|
17 | def addStudent(student): |
---|
18 | """Add an IStudent object and subcontainers. |
---|
19 | |
---|
20 | """ |
---|
21 | |
---|
22 | def archive(id=None): |
---|
23 | """Create on-dist archive of students. |
---|
24 | |
---|
25 | If id is `None`, all students are archived. |
---|
26 | |
---|
27 | If id contains a single id string, only the respective |
---|
28 | students are archived. |
---|
29 | |
---|
30 | If id contains a list of id strings all of the respective |
---|
31 | students types are saved to disk. |
---|
32 | """ |
---|
33 | |
---|
34 | def clear(id=None, archive=True): |
---|
35 | """Remove students of type given by 'id'. |
---|
36 | |
---|
37 | Optionally archive the students. |
---|
38 | |
---|
39 | If id is `None`, all students are archived. |
---|
40 | |
---|
41 | If id contains a single id string, only the respective |
---|
42 | students are archived. |
---|
43 | |
---|
44 | If id contains a list of id strings all of the respective |
---|
45 | student types are saved to disk. |
---|
46 | |
---|
47 | If `archive` is ``False`` none of the archive-handling is done |
---|
48 | and respective students are simply removed from the |
---|
49 | database. |
---|
50 | """ |
---|
51 | |
---|
52 | class IStudentNavigation(IWAeUPObject): |
---|
53 | """Interface needed for student navigation. |
---|
54 | """ |
---|
55 | |
---|
56 | def getStudent(): |
---|
57 | """Return student object. |
---|
58 | """ |
---|
59 | |
---|
60 | class IStudentBase(IWAeUPObject): |
---|
61 | """Representation of student base data. |
---|
62 | """ |
---|
63 | history = Attribute('Object history, a list of messages.') |
---|
64 | state = Attribute('Returns the registration state of a student') |
---|
65 | #student_id = Attribute('Randomly generated id') |
---|
66 | password = Attribute('Encrypted password of a student') |
---|
67 | adm_code = Attribute('Admission checking access code') |
---|
68 | |
---|
69 | def loggerInfo(ob_class, comment): |
---|
70 | """Adds an INFO message to the log file |
---|
71 | """ |
---|
72 | |
---|
73 | student_id = schema.TextLine( |
---|
74 | title = u'Student ID', |
---|
75 | required = True, |
---|
76 | ) |
---|
77 | |
---|
78 | name = schema.TextLine( |
---|
79 | title = u'Full Name', |
---|
80 | default = u'Nobody', |
---|
81 | required = True, |
---|
82 | ) |
---|
83 | |
---|
84 | reg_number = schema.TextLine( |
---|
85 | title = u'Registration Number', |
---|
86 | default = u'', |
---|
87 | required = True, |
---|
88 | readonly = False, |
---|
89 | ) |
---|
90 | |
---|
91 | class IStudentClearance(IWAeUPObject): |
---|
92 | """Representation of student clearance data. |
---|
93 | """ |
---|
94 | |
---|
95 | date_of_birth = schema.Date( |
---|
96 | title = u'Date of Birth', |
---|
97 | required = True, |
---|
98 | ) |
---|
99 | |
---|
100 | clearance_locked = schema.Bool( |
---|
101 | title = u'Clearance form locked', |
---|
102 | default = False, |
---|
103 | ) |
---|
104 | |
---|
105 | class IStudentPersonal(IWAeUPObject): |
---|
106 | """Representation of student personal data. |
---|
107 | """ |
---|
108 | |
---|
109 | perm_address = schema.Text( |
---|
110 | title = u'Permanent Address', |
---|
111 | required = False, |
---|
112 | ) |
---|
113 | |
---|
114 | class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): |
---|
115 | """Representation of a student. |
---|
116 | """ |
---|
117 | |
---|
118 | class IStudentStudyCourse(IWAeUPObject): |
---|
119 | """A container for student study levels. |
---|
120 | |
---|
121 | """ |
---|
122 | |
---|
123 | certificate = schema.Choice( |
---|
124 | title = u'Certificate', |
---|
125 | source = CertificateSource(), |
---|
126 | default = None, |
---|
127 | required = True, |
---|
128 | ) |
---|
129 | |
---|
130 | current_session = schema.Choice( |
---|
131 | title = u'Current Session', |
---|
132 | source = entry_session_vocab, |
---|
133 | default = None, |
---|
134 | required = True, |
---|
135 | ) |
---|
136 | |
---|
137 | current_level = schema.Choice( |
---|
138 | title = u'Current Level', |
---|
139 | source = study_levels, |
---|
140 | default = None, |
---|
141 | required = True, |
---|
142 | ) |
---|
143 | |
---|
144 | current_verdict = schema.Choice( |
---|
145 | title = u'Current Verdict', |
---|
146 | source = verdicts, |
---|
147 | default = None, |
---|
148 | required = True, |
---|
149 | ) |
---|
150 | |
---|
151 | previous_verdict = schema.Choice( |
---|
152 | title = u'Previous Verdict', |
---|
153 | source = verdicts, |
---|
154 | default = None, |
---|
155 | required = True, |
---|
156 | ) |
---|
157 | |
---|
158 | class IStudentAccommodation(IWAeUPObject): |
---|
159 | """A container for student accommodation objects. |
---|
160 | |
---|
161 | """ |
---|
162 | |
---|
163 | class IStudentPayments(IWAeUPObject): |
---|
164 | """A container for student payment objects. |
---|
165 | |
---|
166 | """ |
---|
167 | |
---|
168 | # Interfaces for students only |
---|
169 | |
---|
170 | class IStudentBaseEdit(IStudentBase): |
---|
171 | """Interface needed for editing of student base data by students. |
---|
172 | """ |
---|
173 | |
---|
174 | name = schema.TextLine( |
---|
175 | title = u'Full Name', |
---|
176 | default = u'Nobody', |
---|
177 | required = True, |
---|
178 | readonly = True, |
---|
179 | ) |
---|
180 | |
---|
181 | IStudentBaseEdit['name'].order = IStudentBase['name'].order |
---|
182 | |
---|
183 | class IStudentClearanceEdit(IStudentClearance): |
---|
184 | """Interface needed for restricted editing of student clearance data. |
---|
185 | """ |
---|
186 | |
---|
187 | class IStudentPersonalEdit(IStudentPersonal): |
---|
188 | """Interface needed for restricted editing of student personal data. |
---|
189 | """ |
---|