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

Last change on this file since 6794 was 6793, checked in by Henrik Bettermann, 14 years ago

Each study level (course list) belongs to a session, is validated by a course adviser and finally closed by assigning a verdict due import.

  • Property svn:keywords set to Id
File size: 7.0 KB
RevLine 
[6621]1##
2## interfaces.py
[6788]3from zope.interface import Attribute, invariant
[6756]4from zope.interface.exceptions import Invalid
[6621]5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
[6788]7from waeup.sirp.schema import TextLineChoice
[6648]8from waeup.sirp.students.vocabularies import (
[6788]9  CertificateSource, academic_sessions_vocab, verdicts, StudyLevelSource,
10  contextual_reg_num_source, contextual_mat_num_source,
[6648]11  )
[6621]12
[6692]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
[6642]53class IStudentNavigation(IWAeUPObject):
54    """Interface needed for student navigation.
55    """
56
57    def getStudent():
58        """Return student object.
59        """
60
[6756]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,
[6764]68        readonly = True
[6756]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
[6631]87class IStudentBase(IWAeUPObject):
88    """Representation of student base data.
[6621]89    """
[6637]90    history = Attribute('Object history, a list of messages.')
91    state = Attribute('Returns the registration state of a student')
[6699]92    password = Attribute('Encrypted password of a student')
[6637]93
94    def loggerInfo(ob_class, comment):
95        """Adds an INFO message to the log file
96        """
97
[6665]98    student_id = schema.TextLine(
99        title = u'Student ID',
100        required = True,
101        )
102
[6621]103    name = schema.TextLine(
[6631]104        title = u'Full Name',
[6621]105        default = u'Nobody',
106        required = True,
107        )
108
[6788]109    reg_number = TextLineChoice(
[6696]110        title = u'Registration Number',
[6788]111        #default = u'',
[6696]112        required = True,
113        readonly = False,
[6788]114        source = contextual_reg_num_source,
[6696]115        )
116
[6788]117    matric_number = TextLineChoice(
[6750]118        title = u'Matriculation Number',
[6788]119        #default = u'',
[6750]120        required = False,
121        readonly = False,
[6788]122        source = contextual_mat_num_source,
[6750]123        )
124
[6769]125    adm_code = schema.TextLine(
[6771]126        title = u'PWD Access Code',
[6769]127        default = u'',
128        required = False,
129        readonly = True,
130        )
131
[6631]132class IStudentClearance(IWAeUPObject):
133    """Representation of student clearance data.
134    """
[6622]135
[6631]136    date_of_birth = schema.Date(
137        title = u'Date of Birth',
138        required = True,
139        )
140
[6695]141    clearance_locked = schema.Bool(
142        title = u'Clearance form locked',
143        default = False,
144        )
145
[6769]146    clr_code = schema.TextLine(
[6771]147        title = u'CLR Access Code',
[6769]148        default = u'',
149        required = False,
150        readonly = True,
151        )
152
[6631]153class IStudentPersonal(IWAeUPObject):
154    """Representation of student personal data.
155    """
156
[6651]157    perm_address = schema.Text(
[6631]158        title = u'Permanent Address',
159        required = False,
160        )
161
162class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
163    """Representation of a student.
164    """
165
[6633]166class IStudentStudyCourse(IWAeUPObject):
167    """A container for student study levels.
168
169    """
170
[6648]171    certificate = schema.Choice(
172        title = u'Certificate',
173        source = CertificateSource(),
174        default = None,
[6633]175        required = True,
176        )
[6635]177
[6724]178    current_session = schema.Choice(
179        title = u'Current Session',
[6744]180        source = academic_sessions_vocab,
[6724]181        default = None,
182        required = True,
183        )
184
185    current_level = schema.Choice(
186        title = u'Current Level',
[6725]187        source = StudyLevelSource(),
[6724]188        default = None,
[6725]189        required = False,
[6724]190        )
191
192    current_verdict = schema.Choice(
193        title = u'Current Verdict',
194        source = verdicts,
195        default = None,
[6725]196        required = False,
[6724]197        )
198
199    previous_verdict = schema.Choice(
200        title = u'Previous Verdict',
201        source = verdicts,
202        default = None,
[6725]203        required = False,
[6724]204        )
205
[6774]206class IStudentStudyLevel(IWAeUPObject):
207    """A container for course tickets.
208
209    """
210    level = Attribute('The level code')
[6793]211    validation_date = Attribute('The date of validation')
212    validated_by = Attribute('User Id of course adviser')
[6774]213
[6793]214    level_session = schema.Choice(
215        title = u'Session',
216        source = academic_sessions_vocab,
217        default = None,
218        required = True,
219        )
[6781]220
[6793]221    level_verdict = schema.Choice(
222        title = u'Verdict',
223        source = verdicts,
224        default = None,
225        required = False,
226        )
227
228
[6781]229class ICourseTicket(IWAeUPObject):
230    """A course ticket.
231
232    """
[6783]233    code = Attribute('code of the original course')
234    title = Attribute('title of the original course')
235    credits = Attribute('credits of the original course')
236    passmark = Attribute('passmark of the original course')
237    semester = Attribute('semester of the original course')
238    faculty = Attribute('faculty of the original course')
239    department = Attribute('department of the original course')
[6781]240    core_or_elective = Attribute('core_or_elective of the original course referrer')
[6783]241    level = Attribute('level of the original course referrer')
[6781]242
243    score = schema.Int(
244        title = u'Score',
245        default = 0,
246        required = False,
247        readonly = False,
248        )
249
250    grade = schema.TextLine(
251        title = u'Grade',
252        default = u'',
253        required = False,
254        readonly = True,
255        )
256
[6635]257class IStudentAccommodation(IWAeUPObject):
258    """A container for student accommodation objects.
259
260    """
261
262class IStudentPayments(IWAeUPObject):
263    """A container for student payment objects.
264
265    """
266
[6694]267# Interfaces for students only
268
269class IStudentClearanceEdit(IStudentClearance):
270    """Interface needed for restricted editing of student clearance data.
271    """
272
273class IStudentPersonalEdit(IStudentPersonal):
274    """Interface needed for restricted editing of student personal data.
275    """
Note: See TracBrowser for help on using the repository browser.