[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 | |
---|
[6621] | 29 | name = schema.TextLine( |
---|
[6631] | 30 | title = u'Full Name', |
---|
[6621] | 31 | default = u'Nobody', |
---|
| 32 | required = True, |
---|
| 33 | ) |
---|
| 34 | |
---|
[6631] | 35 | class IStudentClearance(IWAeUPObject): |
---|
| 36 | """Representation of student clearance data. |
---|
| 37 | """ |
---|
[6622] | 38 | |
---|
[6631] | 39 | date_of_birth = schema.Date( |
---|
| 40 | title = u'Date of Birth', |
---|
| 41 | required = True, |
---|
| 42 | ) |
---|
| 43 | |
---|
| 44 | class IStudentPersonal(IWAeUPObject): |
---|
| 45 | """Representation of student personal data. |
---|
| 46 | """ |
---|
| 47 | |
---|
[6651] | 48 | perm_address = schema.Text( |
---|
[6631] | 49 | title = u'Permanent Address', |
---|
| 50 | required = False, |
---|
| 51 | ) |
---|
| 52 | |
---|
| 53 | class IStudent(IStudentBase,IStudentClearance,IStudentPersonal): |
---|
| 54 | """Representation of a student. |
---|
| 55 | """ |
---|
| 56 | |
---|
[6621] | 57 | class IStudentsContainer(IWAeUPObject): |
---|
| 58 | """An students container contains university students. |
---|
| 59 | |
---|
| 60 | """ |
---|
| 61 | |
---|
[6642] | 62 | def addStudent(student): |
---|
[6633] | 63 | """Add an IStudent object and subcontainers. |
---|
| 64 | |
---|
| 65 | """ |
---|
| 66 | |
---|
[6621] | 67 | def archive(id=None): |
---|
| 68 | """Create on-dist archive of students. |
---|
| 69 | |
---|
| 70 | If id is `None`, all students are archived. |
---|
| 71 | |
---|
| 72 | If id contains a single id string, only the respective |
---|
| 73 | students are archived. |
---|
| 74 | |
---|
| 75 | If id contains a list of id strings all of the respective |
---|
| 76 | students types are saved to disk. |
---|
| 77 | """ |
---|
| 78 | |
---|
| 79 | def clear(id=None, archive=True): |
---|
| 80 | """Remove students of type given by 'id'. |
---|
| 81 | |
---|
| 82 | Optionally archive the students. |
---|
| 83 | |
---|
| 84 | If id is `None`, all students are archived. |
---|
| 85 | |
---|
| 86 | If id contains a single id string, only the respective |
---|
| 87 | students are archived. |
---|
| 88 | |
---|
| 89 | If id contains a list of id strings all of the respective |
---|
| 90 | student types are saved to disk. |
---|
| 91 | |
---|
| 92 | If `archive` is ``False`` none of the archive-handling is done |
---|
| 93 | and respective students are simply removed from the |
---|
| 94 | database. |
---|
| 95 | """ |
---|
[6633] | 96 | |
---|
| 97 | class IStudentStudyCourse(IWAeUPObject): |
---|
| 98 | """A container for student study levels. |
---|
| 99 | |
---|
| 100 | """ |
---|
| 101 | |
---|
[6648] | 102 | certificate = schema.Choice( |
---|
| 103 | title = u'Certificate', |
---|
| 104 | source = CertificateSource(), |
---|
| 105 | default = None, |
---|
[6633] | 106 | required = True, |
---|
| 107 | ) |
---|
[6635] | 108 | |
---|
| 109 | class IStudentAccommodation(IWAeUPObject): |
---|
| 110 | """A container for student accommodation objects. |
---|
| 111 | |
---|
| 112 | """ |
---|
| 113 | |
---|
| 114 | class IStudentPayments(IWAeUPObject): |
---|
| 115 | """A container for student payment objects. |
---|
| 116 | |
---|
| 117 | """ |
---|
| 118 | |
---|