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

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

We don't need the StudentBaseEdit? page any more. Student won't be allowed to edit their base data.

The password shouldn't be a form field on the StudentBaseManageFormPage?. I still prefer a simple attribute declaration. Why do we need a schema field?

Students are not allowed to edit their name.

  • Property svn:keywords set to Id
File size: 5.2 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    adm_code = Attribute('Admission checking access code')
94
95    def loggerInfo(ob_class, comment):
96        """Adds an INFO message to the log file
97        """
98
99    student_id = schema.TextLine(
100        title = u'Student ID',
101        required = True,
102        )
103
104    name = schema.TextLine(
105        title = u'Full Name',
106        default = u'Nobody',
107        required = True,
108        )
109
110    reg_number = schema.TextLine(
111        title = u'Registration Number',
112        default = u'',
113        required = True,
114        readonly = False,
115        )
116
117    matric_number = schema.TextLine(
118        title = u'Matriculation Number',
119        default = u'',
120        required = False,
121        readonly = False,
122        )
123
124class IStudentClearance(IWAeUPObject):
125    """Representation of student clearance data.
126    """
127
128    date_of_birth = schema.Date(
129        title = u'Date of Birth',
130        required = True,
131        )
132
133    clearance_locked = schema.Bool(
134        title = u'Clearance form locked',
135        default = False,
136        )
137
138class IStudentPersonal(IWAeUPObject):
139    """Representation of student personal data.
140    """
141
142    perm_address = schema.Text(
143        title = u'Permanent Address',
144        required = False,
145        )
146
147class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
148    """Representation of a student.
149    """
150
151class IStudentStudyCourse(IWAeUPObject):
152    """A container for student study levels.
153
154    """
155
156    certificate = schema.Choice(
157        title = u'Certificate',
158        source = CertificateSource(),
159        default = None,
160        required = True,
161        )
162
163    current_session = schema.Choice(
164        title = u'Current Session',
165        source = academic_sessions_vocab,
166        default = None,
167        required = True,
168        )
169
170    current_level = schema.Choice(
171        title = u'Current Level',
172        source = StudyLevelSource(),
173        default = None,
174        required = False,
175        )
176
177    current_verdict = schema.Choice(
178        title = u'Current Verdict',
179        source = verdicts,
180        default = None,
181        required = False,
182        )
183
184    previous_verdict = schema.Choice(
185        title = u'Previous Verdict',
186        source = verdicts,
187        default = None,
188        required = False,
189        )
190
191class IStudentAccommodation(IWAeUPObject):
192    """A container for student accommodation objects.
193
194    """
195
196class IStudentPayments(IWAeUPObject):
197    """A container for student payment objects.
198
199    """
200
201# Interfaces for students only
202
203class IStudentClearanceEdit(IStudentClearance):
204    """Interface needed for restricted editing of student clearance data.
205    """
206
207class IStudentPersonalEdit(IStudentPersonal):
208    """Interface needed for restricted editing of student personal data.
209    """
Note: See TracBrowser for help on using the repository browser.