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

More documentation.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • 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.