1 | .. _student_section: |
---|
2 | |
---|
3 | Student Section :sup:`in progress` |
---|
4 | ********************************** |
---|
5 | |
---|
6 | 'Student' is a multi-purpose term in Kofa which may lead to some misconceptions. First of all 'Student' is a Python/Grok container class and student objects are the instances of this class. Sometimes we are sluggish when talking about 'creating students' and actually mean: 'creating student container objects and storing the objects (persistently) in the ``students`` container'. The latter is the parent container for all students in the portal. |
---|
7 | |
---|
8 | The :ref:`treelike storage of objects <object_database>` in the student section can be figured as follows:: |
---|
9 | |
---|
10 | |
---|
11 | Student Section (StudentsContainer) |
---|
12 | | |
---|
13 | +---> Student |
---|
14 | | |
---|
15 | +---> StudentStudyCourse |
---|
16 | | | |
---|
17 | | +-----> StudentStudyLevel |
---|
18 | | | |
---|
19 | | +-----> CourseTicket |
---|
20 | | |
---|
21 | +---> StudentPaymentsContainer |
---|
22 | | | |
---|
23 | | +-----> StudentOnlinePayment |
---|
24 | | |
---|
25 | +---> StudentAccommodation |
---|
26 | | |
---|
27 | +-----> BedTicket |
---|
28 | |
---|
29 | |
---|
30 | .. note:: |
---|
31 | |
---|
32 | Throughout Kofa we distinguish singular and plural expressions. A students container contains students (or more precisely student containers), a payments container contains payments, a courses container contains courses, a certificates container contains certificates. |
---|
33 | |
---|
34 | Furthermore, a student is also a user of the portal and the student object is a user account surrogate, see :ref:`Applicants and Students <applicants_and_students>`. In the following we always refer to the student container when talking about a student. |
---|
35 | |
---|
36 | Students |
---|
37 | ======== |
---|
38 | |
---|
39 | The `Student` class is a container class which means, there are not only attributes describing the student entity but also content. Each student container contains exactly three sub-containers: ``studycourse`` (instance of `StudentStudyCourse`), ``payments`` (instance of `StudentPaymentsContainer`) ``accommodation`` (instance of `StudentAccommodation`). The purposes of them are described further below. |
---|
40 | |
---|
41 | Let's talk about the attributes and methods belonging to the `Student` class, the so-called 'external behaviour' of student objects specified in Zope 'interfaces'. The data stored with each student object are subdivided into three parts: base data, personal data and clearance data. Each part has its own interface. |
---|
42 | |
---|
43 | .. note:: |
---|
44 | |
---|
45 | **Interfaces** are one of the pillars of Zope's Component Architecture (ZCA, see also :ref:`prerequisites`). They document the 'external behaviour' of objects. In Kofa interfaces are used to specify the attributes, methods and schema fields of objects. The first two are well-known Python concepts. A Zope schema field is a bit more complicated. It's a detailed description of a field to be submitted via forms to the server, or which is processed by a batch processor. In both cases the input data are being validated against the schema. In Kofa, schema fields in interfaces are also used to automtically add `FieldProperty` attributes of the same name to most content classes. This is done by a class function called :py:func:`attrs_to_fields<waeup.kofa.utils.helpers.attrs_to_fields>` during startup. These class attributes ensure that corresponding attributes of instances of this class - when being added or changed - always meet the requirements of the schema. Another big advantage of such class attributes is, that attributes with a `FieldProperty` do not need to be set in `__init__` methods. |
---|
46 | |
---|
47 | All student classes implement `waeup.kofa.students.interfaces.IStudent` which defines a base set of attributes, schema fields and methods all students must provide. This 'behaviour' is fundamental so that we quote and explain the source code here. |
---|
48 | |
---|
49 | .. literalinclude:: ../../../src/waeup/kofa/students/interfaces.py |
---|
50 | :pyobject: IStudentBase |
---|
51 | |
---|
52 | The first part of the interface lists attributes. Except for the first two (`password` and `temp_password`) they are all read-only property attributes, i.e. attributes with a getter method only. These properties are computed dynamically and can't be set. Most of them return data derived from the ``studycourse`` subobject. |
---|
53 | |
---|
54 | The second part of the interface specifies the schema fields, which are instances of schema classes with their `title`, `description`, `default`, `required`, `readonly` and `source` attributes. |
---|
55 | |
---|
56 | |
---|
57 | Student Study Courses |
---|
58 | ===================== |
---|
59 | |
---|
60 | Student Study Levels |
---|
61 | -------------------- |
---|
62 | |
---|
63 | Student Payments |
---|
64 | ================ |
---|
65 | |
---|
66 | Student Accommodation |
---|
67 | ===================== |
---|