1 | ## |
---|
2 | ## interfaces.py |
---|
3 | from zope.interface import Interface, Attribute |
---|
4 | from zope import schema |
---|
5 | from waeup.sirp.interfaces import IWAeUPObject |
---|
6 | from waeup.sirp.students.vocabularies import ( |
---|
7 | year_range, lgas_vocab, CertificateSource, GenderSource, |
---|
8 | ) |
---|
9 | |
---|
10 | class IStudentsContainer(IWAeUPObject): |
---|
11 | """An students container contains university students. |
---|
12 | |
---|
13 | """ |
---|
14 | |
---|
15 | def addStudent(student): |
---|
16 | """Add an IStudent object and subcontainers. |
---|
17 | |
---|
18 | """ |
---|
19 | |
---|
20 | def archive(id=None): |
---|
21 | """Create on-dist archive of students. |
---|
22 | |
---|
23 | If id is `None`, all students are archived. |
---|
24 | |
---|
25 | If id contains a single id string, only the respective |
---|
26 | students are archived. |
---|
27 | |
---|
28 | If id contains a list of id strings all of the respective |
---|
29 | students types are saved to disk. |
---|
30 | """ |
---|
31 | |
---|
32 | def clear(id=None, archive=True): |
---|
33 | """Remove students of type given by 'id'. |
---|
34 | |
---|
35 | Optionally archive the students. |
---|
36 | |
---|
37 | If id is `None`, all students are archived. |
---|
38 | |
---|
39 | If id contains a single id string, only the respective |
---|
40 | students are archived. |
---|
41 | |
---|
42 | If id contains a list of id strings all of the respective |
---|
43 | student types are saved to disk. |
---|
44 | |
---|
45 | If `archive` is ``False`` none of the archive-handling is done |
---|
46 | and respective students are simply removed from the |
---|
47 | database. |
---|
48 | """ |
---|
49 | |
---|
50 | class IStudentNavigation(IWAeUPObject): |
---|
51 | """Interface needed for student navigation. |
---|
52 | """ |
---|
53 | |
---|
54 | def getStudent(): |
---|
55 | """Return student object. |
---|
56 | """ |
---|
57 | |
---|
58 | class IStudentBase(IWAeUPObject): |
---|
59 | """Representation of student base data. |
---|
60 | """ |
---|
61 | history = Attribute('Object history, a list of messages.') |
---|
62 | state = Attribute('Returns the registration state of a student') |
---|
63 | #student_id = Attribute('Randomly generated id') |
---|
64 | password = Attribute('Encrypted password of a student') |
---|
65 | adm_code = Attribute('Admission checking access code') |
---|
66 | |
---|
67 | def loggerInfo(ob_class, comment): |
---|
68 | """Adds an INFO message to the log file |
---|
69 | """ |
---|
70 | |
---|
71 | student_id = schema.TextLine( |
---|
72 | title = u'Student ID', |
---|
73 | required = True, |
---|
74 | ) |
---|
75 | |
---|
76 | name = schema.TextLine( |
---|
77 | title = u'Full Name', |
---|
78 | default = u'Nobody', |
---|
79 | required = True, |
---|
80 | ) |
---|
81 | |
---|
82 | reg_number = schema.TextLine( |
---|
83 | title = u'Registration Number', |
---|
84 | default = u'', |
---|
85 | required = True, |
---|
86 | readonly = False, |
---|
87 | ) |
---|
88 | |
---|
89 | class IStudentClearance(IWAeUPObject): |
---|
90 | """Representation of student clearance data. |
---|
91 | """ |
---|
92 | |
---|
93 | date_of_birth = schema.Date( |
---|
94 | title = u'Date of Birth', |
---|
95 | required = True, |
---|
96 | ) |
---|
97 | |
---|
98 | clearance_locked = schema.Bool( |
---|
99 | title = u'Clearance form locked', |
---|
100 | default = False, |
---|
101 | ) |
---|
102 | |
---|
103 | class IStudentPersonal(IWAeUPObject): |
---|
104 | """Representation of student personal data. |
---|
105 | """ |
---|
106 | |
---|
107 | perm_address = schema.Text( |
---|
108 | title = u'Permanent Address', |
---|
109 | required = False, |
---|
110 | ) |
---|
111 | |
---|
112 | class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): |
---|
113 | """Representation of a student. |
---|
114 | """ |
---|
115 | |
---|
116 | class IStudentStudyCourse(IWAeUPObject): |
---|
117 | """A container for student study levels. |
---|
118 | |
---|
119 | """ |
---|
120 | |
---|
121 | certificate = schema.Choice( |
---|
122 | title = u'Certificate', |
---|
123 | source = CertificateSource(), |
---|
124 | default = None, |
---|
125 | required = True, |
---|
126 | ) |
---|
127 | |
---|
128 | class IStudentAccommodation(IWAeUPObject): |
---|
129 | """A container for student accommodation objects. |
---|
130 | |
---|
131 | """ |
---|
132 | |
---|
133 | class IStudentPayments(IWAeUPObject): |
---|
134 | """A container for student payment objects. |
---|
135 | |
---|
136 | """ |
---|
137 | |
---|
138 | # Interfaces for students only |
---|
139 | |
---|
140 | class IStudentBaseEdit(IStudentBase): |
---|
141 | """Interface needed for editing of student base data by students. |
---|
142 | """ |
---|
143 | |
---|
144 | name = schema.TextLine( |
---|
145 | title = u'Full Name', |
---|
146 | default = u'Nobody', |
---|
147 | required = True, |
---|
148 | readonly = True, |
---|
149 | ) |
---|
150 | |
---|
151 | IStudentBaseEdit['name'].order = IStudentBase['name'].order |
---|
152 | |
---|
153 | class IStudentClearanceEdit(IStudentClearance): |
---|
154 | """Interface needed for restricted editing of student clearance data. |
---|
155 | """ |
---|
156 | |
---|
157 | class IStudentPersonalEdit(IStudentPersonal): |
---|
158 | """Interface needed for restricted editing of student personal data. |
---|
159 | """ |
---|