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

Last change on this file since 6758 was 6756, checked in by uli, 13 years ago

Merge changes from uli-studentpw back into trunk.

  • Property svn:keywords set to Id
File size: 5.6 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        )
69
70    password = schema.Password(
71        title = u'New password',
72        required = False,
73        )
74
75    password_repeat = schema.Password(
76        title = u'Retype new password',
77        required = False,
78        )
79
80    @invariant
81    def passwords_match(obj):
82        if obj.password == obj.password_repeat:
83            return
84        raise Invalid('passwords do not match')
85
86class IStudentBase(IWAeUPObject):
87    """Representation of student base data.
88    """
89    history = Attribute('Object history, a list of messages.')
90    state = Attribute('Returns the registration state of a student')
91    password = Attribute('Encrypted password of a student')
92    adm_code = Attribute('Admission checking access code')
93
94    password = schema.Password(
95        title = u'Password',
96        required = False,
97        )
98
99    def loggerInfo(ob_class, comment):
100        """Adds an INFO message to the log file
101        """
102
103    student_id = schema.TextLine(
104        title = u'Student ID',
105        required = True,
106        )
107
108    name = schema.TextLine(
109        title = u'Full Name',
110        default = u'Nobody',
111        required = True,
112        )
113
114    reg_number = schema.TextLine(
115        title = u'Registration Number',
116        default = u'',
117        required = True,
118        readonly = False,
119        )
120
121    matric_number = schema.TextLine(
122        title = u'Matriculation Number',
123        default = u'',
124        required = False,
125        readonly = False,
126        )
127
128class IStudentClearance(IWAeUPObject):
129    """Representation of student clearance data.
130    """
131
132    date_of_birth = schema.Date(
133        title = u'Date of Birth',
134        required = True,
135        )
136
137    clearance_locked = schema.Bool(
138        title = u'Clearance form locked',
139        default = False,
140        )
141
142class IStudentPersonal(IWAeUPObject):
143    """Representation of student personal data.
144    """
145
146    perm_address = schema.Text(
147        title = u'Permanent Address',
148        required = False,
149        )
150
151class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
152    """Representation of a student.
153    """
154
155class IStudentStudyCourse(IWAeUPObject):
156    """A container for student study levels.
157
158    """
159
160    certificate = schema.Choice(
161        title = u'Certificate',
162        source = CertificateSource(),
163        default = None,
164        required = True,
165        )
166
167    current_session = schema.Choice(
168        title = u'Current Session',
169        source = academic_sessions_vocab,
170        default = None,
171        required = True,
172        )
173
174    current_level = schema.Choice(
175        title = u'Current Level',
176        source = StudyLevelSource(),
177        default = None,
178        required = False,
179        )
180
181    current_verdict = schema.Choice(
182        title = u'Current Verdict',
183        source = verdicts,
184        default = None,
185        required = False,
186        )
187
188    previous_verdict = schema.Choice(
189        title = u'Previous Verdict',
190        source = verdicts,
191        default = None,
192        required = False,
193        )
194
195class IStudentAccommodation(IWAeUPObject):
196    """A container for student accommodation objects.
197
198    """
199
200class IStudentPayments(IWAeUPObject):
201    """A container for student payment objects.
202
203    """
204
205# Interfaces for students only
206
207class IStudentBaseEdit(IStudentBase):
208    """Interface needed for editing of student base data by students.
209    """
210
211    name = schema.TextLine(
212        title = u'Full Name',
213        default = u'Nobody',
214        required = True,
215        readonly = True,
216        )
217
218IStudentBaseEdit['name'].order =  IStudentBase['name'].order
219
220class IStudentClearanceEdit(IStudentClearance):
221    """Interface needed for restricted editing of student clearance data.
222    """
223
224class IStudentPersonalEdit(IStudentPersonal):
225    """Interface needed for restricted editing of student personal data.
226    """
Note: See TracBrowser for help on using the repository browser.