source: main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py @ 6792

Last change on this file since 6792 was 6788, checked in by uli, 13 years ago

Clean up imports and use new TextLineChoice? schema field along with
contextual source binders.

  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1##
2## interfaces.py
3from zope.interface import Attribute, invariant
4from zope.interface.exceptions import Invalid
5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
7from waeup.sirp.schema import TextLineChoice
8from waeup.sirp.students.vocabularies import (
9  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
10  contextual_reg_num_source, contextual_mat_num_source,
11  )
12
13class IStudentsContainer(IWAeUPObject):
14    """An students container contains university students.
15
16    """
17
18    def addStudent(student):
19        """Add an IStudent object and subcontainers.
20
21        """
22
23    def archive(id=None):
24        """Create on-dist archive of students.
25
26        If id is `None`, all students are archived.
27
28        If id contains a single id string, only the respective
29        students are archived.
30
31        If id contains a list of id strings all of the respective
32        students types are saved to disk.
33        """
34
35    def clear(id=None, archive=True):
36        """Remove students of type given by 'id'.
37
38        Optionally archive the students.
39
40        If id is `None`, all students are archived.
41
42        If id contains a single id string, only the respective
43        students are archived.
44
45        If id contains a list of id strings all of the respective
46        student types are saved to disk.
47
48        If `archive` is ``False`` none of the archive-handling is done
49        and respective students are simply removed from the
50        database.
51        """
52
53class IStudentNavigation(IWAeUPObject):
54    """Interface needed for student navigation.
55    """
56
57    def getStudent():
58        """Return student object.
59        """
60
61class IStudentPasswordSetting(IWAeUPObject):
62    """Data needed for password setting.
63    """
64    name = schema.TextLine(
65        title = u'Full Name',
66        default = u'Nobody',
67        required = True,
68        readonly = True
69        )
70
71    password = schema.Password(
72        title = u'New password',
73        required = False,
74        )
75
76    password_repeat = schema.Password(
77        title = u'Retype new password',
78        required = False,
79        )
80
81    @invariant
82    def passwords_match(obj):
83        if obj.password == obj.password_repeat:
84            return
85        raise Invalid('passwords do not match')
86
87class IStudentBase(IWAeUPObject):
88    """Representation of student base data.
89    """
90    history = Attribute('Object history, a list of messages.')
91    state = Attribute('Returns the registration state of a student')
92    password = Attribute('Encrypted password of a student')
93
94    def loggerInfo(ob_class, comment):
95        """Adds an INFO message to the log file
96        """
97
98    student_id = schema.TextLine(
99        title = u'Student ID',
100        required = True,
101        )
102
103    name = schema.TextLine(
104        title = u'Full Name',
105        default = u'Nobody',
106        required = True,
107        )
108
109    reg_number = TextLineChoice(
110        title = u'Registration Number',
111        #default = u'',
112        required = True,
113        readonly = False,
114        source = contextual_reg_num_source,
115        )
116
117    matric_number = TextLineChoice(
118        title = u'Matriculation Number',
119        #default = u'',
120        required = False,
121        readonly = False,
122        source = contextual_mat_num_source,
123        )
124
125    adm_code = schema.TextLine(
126        title = u'PWD Access Code',
127        default = u'',
128        required = False,
129        readonly = True,
130        )
131
132class IStudentClearance(IWAeUPObject):
133    """Representation of student clearance data.
134    """
135
136    date_of_birth = schema.Date(
137        title = u'Date of Birth',
138        required = True,
139        )
140
141    clearance_locked = schema.Bool(
142        title = u'Clearance form locked',
143        default = False,
144        )
145
146    clr_code = schema.TextLine(
147        title = u'CLR Access Code',
148        default = u'',
149        required = False,
150        readonly = True,
151        )
152
153class IStudentPersonal(IWAeUPObject):
154    """Representation of student personal data.
155    """
156
157    perm_address = schema.Text(
158        title = u'Permanent Address',
159        required = False,
160        )
161
162class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
163    """Representation of a student.
164    """
165
166class IStudentStudyCourse(IWAeUPObject):
167    """A container for student study levels.
168
169    """
170
171    certificate = schema.Choice(
172        title = u'Certificate',
173        source = CertificateSource(),
174        default = None,
175        required = True,
176        )
177
178    current_session = schema.Choice(
179        title = u'Current Session',
180        source = academic_sessions_vocab,
181        default = None,
182        required = True,
183        )
184
185    current_level = schema.Choice(
186        title = u'Current Level',
187        source = StudyLevelSource(),
188        default = None,
189        required = False,
190        )
191
192    current_verdict = schema.Choice(
193        title = u'Current Verdict',
194        source = verdicts,
195        default = None,
196        required = False,
197        )
198
199    previous_verdict = schema.Choice(
200        title = u'Previous Verdict',
201        source = verdicts,
202        default = None,
203        required = False,
204        )
205
206class IStudentStudyLevel(IWAeUPObject):
207    """A container for course tickets.
208
209    """
210    level = Attribute('The level code')
211
212
213class ICourseTicket(IWAeUPObject):
214    """A course ticket.
215
216    """
217    code = Attribute('code of the original course')
218    title = Attribute('title of the original course')
219    credits = Attribute('credits of the original course')
220    passmark = Attribute('passmark of the original course')
221    semester = Attribute('semester of the original course')
222    faculty = Attribute('faculty of the original course')
223    department = Attribute('department of the original course')
224    core_or_elective = Attribute('core_or_elective of the original course referrer')
225    level = Attribute('level of the original course referrer')
226
227    score = schema.Int(
228        title = u'Score',
229        default = 0,
230        required = False,
231        readonly = False,
232        )
233
234    grade = schema.TextLine(
235        title = u'Grade',
236        default = u'',
237        required = False,
238        readonly = True,
239        )
240
241class IStudentAccommodation(IWAeUPObject):
242    """A container for student accommodation objects.
243
244    """
245
246class IStudentPayments(IWAeUPObject):
247    """A container for student payment objects.
248
249    """
250
251# Interfaces for students only
252
253class IStudentClearanceEdit(IStudentClearance):
254    """Interface needed for restricted editing of student clearance data.
255    """
256
257class IStudentPersonalEdit(IStudentPersonal):
258    """Interface needed for restricted editing of student personal data.
259    """
Note: See TracBrowser for help on using the repository browser.