[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 |
---|
[6648] | 6 | from waeup.sirp.students.vocabularies import ( |
---|
| 7 | year_range, lgas_vocab, CertificateSource, GenderSource, |
---|
| 8 | ) |
---|
[6621] | 9 | |
---|
[6642] | 10 | class IStudentNavigation(IWAeUPObject): |
---|
| 11 | """Interface needed for student navigation. |
---|
| 12 | """ |
---|
| 13 | |
---|
| 14 | def getStudent(): |
---|
| 15 | """Return student object. |
---|
| 16 | """ |
---|
| 17 | |
---|
[6631] | 18 | class IStudentBase(IWAeUPObject): |
---|
| 19 | """Representation of student base data. |
---|
[6621] | 20 | """ |
---|
[6637] | 21 | history = Attribute('Object history, a list of messages.') |
---|
| 22 | state = Attribute('Returns the registration state of a student') |
---|
[6651] | 23 | student_id = Attribute('Randomly generated id') |
---|
[6637] | 24 | |
---|
| 25 | def loggerInfo(ob_class, comment): |
---|
| 26 | """Adds an INFO message to the log file |
---|
| 27 | """ |
---|
| 28 | |
---|
[6665] | 29 | student_id = schema.TextLine( |
---|
| 30 | title = u'Student ID', |
---|
| 31 | required = True, |
---|
| 32 | ) |
---|
| 33 | |
---|
[6621] | 34 | name = schema.TextLine( |
---|
[6631] | 35 | title = u'Full Name', |
---|
[6621] | 36 | default = u'Nobody', |
---|
| 37 | required = True, |
---|
| 38 | ) |
---|
| 39 | |
---|
[6665] | 40 | password = schema.TextLine( |
---|
| 41 | title = u'Password', |
---|
| 42 | ) |
---|
| 43 | |
---|
[6631] | 44 | class IStudentClearance(IWAeUPObject): |
---|
| 45 | """Representation of student clearance data. |
---|
| 46 | """ |
---|
[6622] | 47 | |
---|
[6631] | 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 | |
---|
[6651] | 57 | perm_address = schema.Text( |
---|
[6631] | 58 | title = u'Permanent Address', |
---|
| 59 | required = False, |
---|
| 60 | ) |
---|
| 61 | |
---|
| 62 | class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): |
---|
| 63 | """Representation of a student. |
---|
| 64 | """ |
---|
| 65 | |
---|
[6621] | 66 | class IStudentsContainer(IWAeUPObject): |
---|
| 67 | """An students container contains university students. |
---|
| 68 | |
---|
| 69 | """ |
---|
| 70 | |
---|
[6642] | 71 | def addStudent(student): |
---|
[6633] | 72 | """Add an IStudent object and subcontainers. |
---|
| 73 | |
---|
| 74 | """ |
---|
| 75 | |
---|
[6621] | 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 | """ |
---|
[6633] | 105 | |
---|
| 106 | class IStudentStudyCourse(IWAeUPObject): |
---|
| 107 | """A container for student study levels. |
---|
| 108 | |
---|
| 109 | """ |
---|
| 110 | |
---|
[6648] | 111 | certificate = schema.Choice( |
---|
| 112 | title = u'Certificate', |
---|
| 113 | source = CertificateSource(), |
---|
| 114 | default = None, |
---|
[6633] | 115 | required = True, |
---|
| 116 | ) |
---|
[6635] | 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 | |
---|