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 IStudentNavigation(IWAeUPObject): |
---|
11 | """Interface needed for student navigation. |
---|
12 | """ |
---|
13 | |
---|
14 | def getStudent(): |
---|
15 | """Return student object. |
---|
16 | """ |
---|
17 | |
---|
18 | class IStudentBase(IWAeUPObject): |
---|
19 | """Representation of student base data. |
---|
20 | """ |
---|
21 | history = Attribute('Object history, a list of messages.') |
---|
22 | state = Attribute('Returns the registration state of a student') |
---|
23 | student_id = Attribute('Randomly generated id') |
---|
24 | |
---|
25 | def loggerInfo(ob_class, comment): |
---|
26 | """Adds an INFO message to the log file |
---|
27 | """ |
---|
28 | |
---|
29 | student_id = schema.TextLine( |
---|
30 | title = u'Student ID', |
---|
31 | required = True, |
---|
32 | ) |
---|
33 | |
---|
34 | name = schema.TextLine( |
---|
35 | title = u'Full Name', |
---|
36 | default = u'Nobody', |
---|
37 | required = True, |
---|
38 | ) |
---|
39 | |
---|
40 | password = schema.TextLine( |
---|
41 | title = u'Password', |
---|
42 | ) |
---|
43 | |
---|
44 | class IStudentClearance(IWAeUPObject): |
---|
45 | """Representation of student clearance data. |
---|
46 | """ |
---|
47 | |
---|
48 | date_of_birth = schema.Date( |
---|
49 | title = u'Date of Birth', |
---|
50 | required = True, |
---|
51 | ) |
---|
52 | |
---|
53 | class IStudentPersonal(IWAeUPObject): |
---|
54 | """Representation of student personal data. |
---|
55 | """ |
---|
56 | |
---|
57 | perm_address = schema.Text( |
---|
58 | title = u'Permanent Address', |
---|
59 | required = False, |
---|
60 | ) |
---|
61 | |
---|
62 | class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): |
---|
63 | """Representation of a student. |
---|
64 | """ |
---|
65 | |
---|
66 | class IStudentsContainer(IWAeUPObject): |
---|
67 | """An students container contains university students. |
---|
68 | |
---|
69 | """ |
---|
70 | |
---|
71 | def addStudent(student): |
---|
72 | """Add an IStudent object and subcontainers. |
---|
73 | |
---|
74 | """ |
---|
75 | |
---|
76 | def archive(id=None): |
---|
77 | """Create on-dist archive of students. |
---|
78 | |
---|
79 | If id is `None`, all students are archived. |
---|
80 | |
---|
81 | If id contains a single id string, only the respective |
---|
82 | students are archived. |
---|
83 | |
---|
84 | If id contains a list of id strings all of the respective |
---|
85 | students types are saved to disk. |
---|
86 | """ |
---|
87 | |
---|
88 | def clear(id=None, archive=True): |
---|
89 | """Remove students of type given by 'id'. |
---|
90 | |
---|
91 | Optionally archive the students. |
---|
92 | |
---|
93 | If id is `None`, all students are archived. |
---|
94 | |
---|
95 | If id contains a single id string, only the respective |
---|
96 | students are archived. |
---|
97 | |
---|
98 | If id contains a list of id strings all of the respective |
---|
99 | student types are saved to disk. |
---|
100 | |
---|
101 | If `archive` is ``False`` none of the archive-handling is done |
---|
102 | and respective students are simply removed from the |
---|
103 | database. |
---|
104 | """ |
---|
105 | |
---|
106 | class IStudentStudyCourse(IWAeUPObject): |
---|
107 | """A container for student study levels. |
---|
108 | |
---|
109 | """ |
---|
110 | |
---|
111 | certificate = schema.Choice( |
---|
112 | title = u'Certificate', |
---|
113 | source = CertificateSource(), |
---|
114 | default = None, |
---|
115 | required = True, |
---|
116 | ) |
---|
117 | |
---|
118 | class IStudentAccommodation(IWAeUPObject): |
---|
119 | """A container for student accommodation objects. |
---|
120 | |
---|
121 | """ |
---|
122 | |
---|
123 | class IStudentPayments(IWAeUPObject): |
---|
124 | """A container for student payment objects. |
---|
125 | |
---|
126 | """ |
---|
127 | |
---|