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

Last change on this file since 6771 was 6771, checked in by Henrik Bettermann, 13 years ago

Turn list of lists into single list with Uli's technique.

Do not log changes made by students. During clearance this would be too much.

  • Property svn:keywords set to Id
File size: 5.4 KB
Line 
1##
2## interfaces.py
3from zope.interface import Interface, Attribute, invariant
4from zope.interface.exceptions import Invalid
5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
7from waeup.sirp.university.vocabularies import study_modes
8from waeup.sirp.students.vocabularies import (
9  year_range, lgas_vocab, CertificateSource, GenderSource,
10  academic_sessions_vocab, verdicts, StudyLevelSource,
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 = schema.TextLine(
110        title = u'Registration Number',
111        default = u'',
112        required = True,
113        readonly = False,
114        )
115
116    matric_number = schema.TextLine(
117        title = u'Matriculation Number',
118        default = u'',
119        required = False,
120        readonly = False,
121        )
122
123    adm_code = schema.TextLine(
124        title = u'PWD Access Code',
125        default = u'',
126        required = False,
127        readonly = True,
128        )
129
130class IStudentClearance(IWAeUPObject):
131    """Representation of student clearance data.
132    """
133
134    date_of_birth = schema.Date(
135        title = u'Date of Birth',
136        required = True,
137        )
138
139    clearance_locked = schema.Bool(
140        title = u'Clearance form locked',
141        default = False,
142        )
143
144    clr_code = schema.TextLine(
145        title = u'CLR Access Code',
146        default = u'',
147        required = False,
148        readonly = True,
149        )
150
151class IStudentPersonal(IWAeUPObject):
152    """Representation of student personal data.
153    """
154
155    perm_address = schema.Text(
156        title = u'Permanent Address',
157        required = False,
158        )
159
160class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
161    """Representation of a student.
162    """
163
164class IStudentStudyCourse(IWAeUPObject):
165    """A container for student study levels.
166
167    """
168
169    certificate = schema.Choice(
170        title = u'Certificate',
171        source = CertificateSource(),
172        default = None,
173        required = True,
174        )
175
176    current_session = schema.Choice(
177        title = u'Current Session',
178        source = academic_sessions_vocab,
179        default = None,
180        required = True,
181        )
182
183    current_level = schema.Choice(
184        title = u'Current Level',
185        source = StudyLevelSource(),
186        default = None,
187        required = False,
188        )
189
190    current_verdict = schema.Choice(
191        title = u'Current Verdict',
192        source = verdicts,
193        default = None,
194        required = False,
195        )
196
197    previous_verdict = schema.Choice(
198        title = u'Previous Verdict',
199        source = verdicts,
200        default = None,
201        required = False,
202        )
203
204class IStudentAccommodation(IWAeUPObject):
205    """A container for student accommodation objects.
206
207    """
208
209class IStudentPayments(IWAeUPObject):
210    """A container for student payment objects.
211
212    """
213
214# Interfaces for students only
215
216class IStudentClearanceEdit(IStudentClearance):
217    """Interface needed for restricted editing of student clearance data.
218    """
219
220class IStudentPersonalEdit(IStudentPersonal):
221    """Interface needed for restricted editing of student personal data.
222    """
Note: See TracBrowser for help on using the repository browser.