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
RevLine 
[6621]1##
2## interfaces.py
[6756]3from zope.interface import Interface, Attribute, invariant
4from zope.interface.exceptions import Invalid
[6621]5from zope import schema
6from waeup.sirp.interfaces import IWAeUPObject
[6724]7from waeup.sirp.university.vocabularies import study_modes
[6648]8from waeup.sirp.students.vocabularies import (
9  year_range, lgas_vocab, CertificateSource, GenderSource,
[6744]10  academic_sessions_vocab, verdicts, StudyLevelSource,
[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,
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
[6631]86class IStudentBase(IWAeUPObject):
87    """Representation of student base data.
[6621]88    """
[6637]89    history = Attribute('Object history, a list of messages.')
90    state = Attribute('Returns the registration state of a student')
[6699]91    password = Attribute('Encrypted password of a student')
[6704]92    adm_code = Attribute('Admission checking access code')
[6637]93
[6756]94    password = schema.Password(
95        title = u'Password',
96        required = False,
97        )
98
[6637]99    def loggerInfo(ob_class, comment):
100        """Adds an INFO message to the log file
101        """
102
[6665]103    student_id = schema.TextLine(
104        title = u'Student ID',
105        required = True,
106        )
107
[6621]108    name = schema.TextLine(
[6631]109        title = u'Full Name',
[6621]110        default = u'Nobody',
111        required = True,
112        )
113
[6696]114    reg_number = schema.TextLine(
115        title = u'Registration Number',
116        default = u'',
117        required = True,
118        readonly = False,
119        )
120
[6750]121    matric_number = schema.TextLine(
122        title = u'Matriculation Number',
123        default = u'',
124        required = False,
125        readonly = False,
126        )
127
[6631]128class IStudentClearance(IWAeUPObject):
129    """Representation of student clearance data.
130    """
[6622]131
[6631]132    date_of_birth = schema.Date(
133        title = u'Date of Birth',
134        required = True,
135        )
136
[6695]137    clearance_locked = schema.Bool(
138        title = u'Clearance form locked',
139        default = False,
140        )
141
[6631]142class IStudentPersonal(IWAeUPObject):
143    """Representation of student personal data.
144    """
145
[6651]146    perm_address = schema.Text(
[6631]147        title = u'Permanent Address',
148        required = False,
149        )
150
151class IStudent(IStudentBase,IStudentClearance,IStudentPersonal):
152    """Representation of a student.
153    """
154
[6633]155class IStudentStudyCourse(IWAeUPObject):
156    """A container for student study levels.
157
158    """
159
[6648]160    certificate = schema.Choice(
161        title = u'Certificate',
162        source = CertificateSource(),
163        default = None,
[6633]164        required = True,
165        )
[6635]166
[6724]167    current_session = schema.Choice(
168        title = u'Current Session',
[6744]169        source = academic_sessions_vocab,
[6724]170        default = None,
171        required = True,
172        )
173
174    current_level = schema.Choice(
175        title = u'Current Level',
[6725]176        source = StudyLevelSource(),
[6724]177        default = None,
[6725]178        required = False,
[6724]179        )
180
181    current_verdict = schema.Choice(
182        title = u'Current Verdict',
183        source = verdicts,
184        default = None,
[6725]185        required = False,
[6724]186        )
187
188    previous_verdict = schema.Choice(
189        title = u'Previous Verdict',
190        source = verdicts,
191        default = None,
[6725]192        required = False,
[6724]193        )
194
[6635]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
[6694]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.