Changeset 12858 for main


Ignore:
Timestamp:
16 Apr 2015, 12:03:32 (9 years ago)
Author:
Henrik Bettermann
Message:

More documentation.

Location:
main/waeup.kofa/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/docs/source/userdocs/datacenter.rst

    r12857 r12858  
    1313Kofa's persistent data are stored in a native object database designed for the Python programming language, the so-called ZODB_. An object database stores objects with attributes and not records as rows with columns in tables. These persistent objects can hold any kind of information in attributes and must not adhere to a specific schema like records in tables of a relational database.
    1414
    15 The ZODB_ also supports a hierarchical, treelike storage of objects. Objects can contain other objects if they are declared as containers. Objects are stored like folders and files in a filesystem. This makes the object handling very fast and transparent because we can access objects, or more precisely views of objects, by indicating their path in the database, i.e. by traversing the database tree to find an object. Furthermore, we are accessing the views of objects through a web browser by entering a URL (Uniform Resource Locator). This publication path corresponds more or less to the traversal path of our objects. In Kofa the path always contains the object identifiers of all objects which are passed when traversing the database tree. Example:
     15The ZODB_ also supports a hierarchical, treelike storage of objects. Objects can contain other objects if they are declared as containers. Objects are stored like folders and files in a filesystem. This makes the object handling very fast and transparent because we can access objects, or more precisely views of objects, by indicating their path in the database, i.e. by traversing the database tree to the object's location. Furthermore, we are accessing the views of objects through a web browser by entering a URL (Uniform Resource Locator). This publication path corresponds more or less to the traversal path of our objects. In Kofa the path always contains the object identifiers of all objects which are passed when traversing the database tree. Example:
    1616
    1717https://kofa-demo.waeup.org/students/K1000000/studycourse/100/DCO
    1818
    19 is the URL which requests a display view of a course ticket with id 'DCO'. This object is stored in a study level container object with id '100', stored in a study course container object with id 'studycourse', stored in the student container object with id 'K1000000', stored in the students root container, stored in the root container of the application, stored in the root of the database itself.
     19is the URL which requests a display view of a course ticket with id ``DCO``. This object is stored in a study level container object with id ``100``, stored in a study course container object with id ``studycourse``, stored in the student container object with id ``K1000000``, stored in the students root container, stored in the root container of the application, stored in the root of the database itself.
    2020
    2121This kind of storage requires that each object gets a unique object identifier (object id) within its container. The id string is visible in the browser address bar. Though it's technically possible for ids to contain spaces or slashes we do not allow these kinds of special characters in object ids to facilitate the readability of URLs.
     
    2626===========
    2727
    28 Regular data exporters (1) collect objects from specific containers, (2) iterate over the collected objects, (3) extract and mangle information from each object, (4) write the information of each object into a row of a CSV file and (5) finally provide the file for download. The CSV file is neither stored in the database nor archived in the filesystem. (3) and (4) is a flattening of the hierarchical data structure, i.e. a mapping of objects to flat relational data stored in a CSV table. The extracted information must not necessarily be based only on static attributes of the collected object. The data, finally stored in the CSV file, can also be derived from parent or child objects, or dynamically computed by the object's methods and property attributes. These methods and properties can retrieve information from everywhere in the portal's database.
     28Regular data exporters (1) collect objects from specific containers, (2) iterate over the collected objects, (3) extract and mangle information from each object, (4) write the information of each object into a row of a CSV file and (5) finally provide the file for download. The CSV file is neither stored in the database nor archived in the filesystem. (3) and (4) means a flattening of the hierarchical data structure, i.e. a mapping of objects to flat relational data to be stored in a CSV table. The extracted information must not necessarily be based only on static attributes of the collected object. The data, finally stored in the CSV file, can also be derived from parent or child objects, or dynamically computed by the object's methods and property attributes. These methods and properties can retrieve information from everywhere in the portal's database.
     29
     30In the following we list all exporter classes including the two attributes and a method description. The `fields` attribute contain the column titles of the export file. These are not necessarily only attributes of the exported objects. The `title` attribute unveils the name of the exporter under which this exporter will be displayed in the user interface. The `mangle_value()` method shows how some of fields are being dynamically computed.
     31
     32Academic Section Exporters
     33--------------------------
    2934
    3035.. autoclass:: waeup.kofa.university.export.FacultyExporter()
     
    3338  .. autoattribute:: waeup.kofa.university.export.FacultyExporter.fields
    3439  .. autoattribute:: waeup.kofa.university.export.FacultyExporter.title
    35 
    3640  .. automethod:: waeup.kofa.university.export.FacultyExporter.mangle_value()
    3741
    3842
     43.. autoclass:: waeup.kofa.university.export.DepartmentExporter()
     44  :noindex:
     45
     46  .. autoattribute:: waeup.kofa.university.export.DepartmentExporter.fields
     47  .. autoattribute:: waeup.kofa.university.export.DepartmentExporter.title
     48  .. automethod:: waeup.kofa.university.export.DepartmentExporter.mangle_value()
     49
     50.. autoclass:: waeup.kofa.university.export.CourseExporter()
     51  :noindex:
     52
     53  .. autoattribute:: waeup.kofa.university.export.CourseExporter.fields
     54  .. autoattribute:: waeup.kofa.university.export.CourseExporter.title
     55  .. automethod:: waeup.kofa.university.export.CourseExporter.mangle_value()
     56
     57.. autoclass:: waeup.kofa.university.export.CertificateExporter()
     58  :noindex:
     59
     60  .. autoattribute:: waeup.kofa.university.export.CertificateExporter.fields
     61  .. autoattribute:: waeup.kofa.university.export.CertificateExporter.title
     62  .. automethod:: waeup.kofa.university.export.CertificateExporter.mangle_value()
     63
     64.. autoclass:: waeup.kofa.university.export.CertificateCourseExporter()
     65  :noindex:
     66
     67  .. autoattribute:: waeup.kofa.university.export.CertificateCourseExporter.fields
     68  .. autoattribute:: waeup.kofa.university.export.CertificateCourseExporter.title
     69  .. automethod:: waeup.kofa.university.export.CertificateCourseExporter.mangle_value()
     70
     71
     72Application Section Exporters
     73-----------------------------
     74
     75
     76Student Section Exporters
     77-------------------------
    3978
    4079
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/captcha.py

    r11254 r12858  
    286286
    287287        The ``error_code`` can be taken from a previously fetched
    288         :class:``CaptchaResponse`` instance (as returned by
    289         :meth:``verify``). If it is not ``None``, it might be
     288        :class:`CaptchaResponse` instance (as returned by
     289        :meth:`verify`). If it is not ``None``, it might be
    290290        displayed inside the generated captcha box (in human readable
    291291        form).
  • main/waeup.kofa/trunk/src/waeup/kofa/university/export.py

    r12857 r12858  
    2424from waeup.kofa.utils.batching import ExporterBase
    2525
     26
    2627class FacultyExporter(grok.GlobalUtility, ExporterBase):
    27     """The FacultyExporter exports all faculties in the 'faculties'
     28    """The Faculty Exporter exports all faculties in the 'faculties'
    2829    container. This is the only place where faculties are stored.
    2930    """
     
    3637
    3738    def mangle_value(self, value, name, context=None):
    38         """The users_with_local_roles column contains Python expression like:
     39        """The mangler computes the users_with_local_roles value which
     40        is a Python expression like:
    3941
    4042        ``[{'user_name': u'bob', 'local_role': u'bobsrole'},
     
    6668        return self.export(faculties.values(), filepath)
    6769
     70
    6871class DepartmentExporter(FacultyExporter, grok.GlobalUtility):
    69     """Exporter for departments.
     72    """The Department Exporter exports all departments stored in the faculty
     73    containers. The exporter iterates over all faculties and then over all
     74    departments inside each faculty container.
    7075    """
    7176    grok.implements(ICSVExporter)
    7277    grok.name('departments')
    7378
    74     #: Fieldnames considered by this exporter
    7579    fields = ('code', 'faculty_code', 'title', 'title_prefix',
    7680        'users_with_local_roles')
     
    7983
    8084    def mangle_value(self, value, name, context=None):
    81         """Hook for mangling values in derived classes
     85        """The mangler additionally computes the faculty_code value
     86        which is the code (= object id) of the faculty that hosts
     87        the department.
    8288        """
    8389        if name == 'faculty_code':
     
    101107
    102108class CourseExporter(FacultyExporter, grok.GlobalUtility):
    103     """Exporter for courses.
     109    """The Course Exporter exports all courses in the database. It iterates
     110    over all departments and faculties.
    104111    """
    105112    grok.implements(ICSVExporter)
    106113    grok.name('courses')
    107114
    108     #: Fieldnames considered by this exporter
    109115    fields = ('code', 'faculty_code', 'department_code', 'title', 'credits',
    110116              'passmark', 'semester', 'users_with_local_roles', 'former_course')
    111117
    112     #: The title under which this exporter will be displayed
    113118    title = _(u'Courses')
    114119
    115120    def mangle_value(self, value, name, context=None):
    116         """
     121        """The mangler additionally computes the department_code value
     122        which is the code of the department that offers the course.
    117123        """
    118124        if name == 'users_with_local_roles':
     
    137143    def export_all(self, site, filepath=None):
    138144        """Export courses into filepath as CSV data.
    139 
    140145        If `filepath` is ``None``, a raw string with CSV data is returned.
    141146        """
     
    148153        return self.close_outfile(filepath, outfile)
    149154
     155
    150156class CertificateExporter(CourseExporter, grok.GlobalUtility):
    151     """Exporter for courses.
     157    """The Certificate Exporter exports all certificates in the database.
     158    It iterates over all departments and faculties.
    152159    """
    153160    grok.implements(ICSVExporter)
    154161    grok.name('certificates')
    155162
    156     #: Fieldnames considered by this exporter
    157163    fields = ('code', 'faculty_code', 'department_code', 'title', 'study_mode',
    158164              'start_level', 'end_level', 'application_category', 'ratio',
     
    162168              'users_with_local_roles')
    163169
    164     #: The title under which this exporter will be displayed
    165170    title = _(u'Certificates')
    166171
     172    def mangle_value(self, value, name, context=None):
     173        """The mangler additionally computes the department_code value
     174        which is the code of the department that offers the certificate.
     175        """
     176        return super(CertificateExporter, self).mangle_value(
     177            value, name, context)
     178
    167179    def export_all(self, site, filepath=None):
    168180        """Export certificates into filepath as CSV data.
    169 
    170181        If `filepath` is ``None``, a raw string with CSV data is returned.
    171182        """
     
    178189        return self.close_outfile(filepath, outfile)
    179190
     191
    180192class CertificateCourseExporter(CourseExporter, grok.GlobalUtility):
    181     """Exporter for courses.
     193    """The Certificate Course Exporter exports all certificate courses
     194    (:class:`CertificateCourse
     195    <waeup.kofa.university.certificate.CertificateCourse>` instances) in
     196    the database. It iterates over all departments and faculties.
    182197    """
    183198    grok.implements(ICSVExporter)
    184199    grok.name('certificate_courses')
    185200
    186     #: Fieldnames considered by this exporter
    187201    fields = ('course', 'faculty_code', 'department_code', 'certificate_code',
    188202              'level', 'mandatory')
    189203
    190     #: The title under which this exporter will be displayed
    191204    title = _(u'Courses in Certificates')
    192205
    193206    def mangle_value(self, value, name, context=None):
    194         """Hook for mangling values in derived classes
     207        """The mangler computes the codes of the faculty, the department and
     208        the certificate which require the course. It also exports the
     209        course code.
     210
     211        .. note:: The course must not necessarily be offered by the same
     212                  department.
    195213        """
    196214        if name == 'faculty_code':
     
    214232    def export_all(self, site, filepath=None):
    215233        """Export certificate courses into filepath as CSV data.
    216 
    217234        If `filepath` is ``None``, a raw string with CSV data is returned.
    218235        """
Note: See TracChangeset for help on using the changeset viewer.