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