students.utils - Student Utilities

General helper functions and utilities for the students section.

class waeup.kofa.students.utils.StudentsUtils[source]

Bases: grokcore.component.components.GlobalUtility

A collection of methods subject to customization.

GPABoundaries(faccode=None, depcode=None, certcode=None)[source]
MAX_KB = 250

A tuple containing the names of registration states in which changing of passport pictures is allowed.


A dictionary which maps widget names to headlines. The headline is rendered in forms and on pdf slips above the respective display or input widget. There are no separating headlines in the base package.


A tuple containing the names of registration states in which changing of scanned signatures is allowed.


A tuple containing names of file upload viewlets which are not shown on the StudentClearanceManageFormPage. Nothing is being skipped in the base package. This attribute makes only sense, if intermediate custom packages are being used, like we do for all Nigerian portals.

STUDENT_BACKUP_EXPORTER_NAMES = ('students', 'studentstudycourses', 'studentstudycourses_1', 'studentstudycourses_2', 'studentstudylevels', 'studentstudylevels_1', 'studentstudylevels_2', 'coursetickets', 'coursetickets_1', 'coursetickets_2', 'studentpayments', 'bedtickets')

A tuple containing all exporter names needed for backing up student data

STUDENT_EXPORTER_NAMES = ('students', 'studentstudycourses', 'studentstudycourses_1', 'studentstudylevels', 'coursetickets', 'studentpayments', 'bedtickets', 'trimmed', 'outstandingcourses', 'unpaidpayments', 'sfpaymentsoverview', 'sessionpaymentsoverview', 'studylevelsoverview', 'combocard', 'bursary', 'accommodationpayments', 'transcriptdata', 'trimmedpayments')

A tuple containing all exporter names referring to students or subobjects thereof.


A prefix used when generating new student ids. Each student id will start with this string. The default is ‘K’ for Kofa.

__doc__ = 'A collection of methods subject to customization.\n '
__implemented__ = <implementedBy waeup.kofa.students.utils.StudentsUtils>
__module__ = 'waeup.kofa.students.utils'

Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.

For example:

>>> from zope.interface import Interface
>>> class IFooFactory(Interface):
...     pass
>>> class IFoo(Interface):
...     pass
>>> class C(object):
...     implements(IFoo)
...     classProvides(IFooFactory)
>>> [i.getName() for i in C.__provides__]
>>> [i.getName() for i in C().__provides__]
_admissionText(student, portal_language)[source]
_isPaymentDisabled(p_session, category, student)[source]
_mergeFiles(mergefiles, watermark, pdf_stream)[source]
_saveTranscriptPDF(student, transcript)[source]

Create a transcript PDF file and store it in student folder.


Check if student is allowed to change the portrait file.

checkAccommodationRequirements(student, acc_details)[source]

Render message if clearance is disabled.


Fetch the matric number counter which fits the student and construct the new matric number of the student. In the base package the counter is returned which is as an attribute of the site configuration container.


Determine the accommodation data of a student.


Return descriptive bed coordinates. This method can be used to customize the display_coordinates property method in order to display a customary description of the bed space.

getClassFromCGPA(gpa, student)[source]

Determine the class of degree. In some custom packages this class depends on e.g. the entry session of the student. In the base package, it does not.


Get degree class number (used for SessionResultsPresentation reports).


Get a pdf creator suitable for context. The default implementation always returns the default creator.


Define what happens after school fee payment depending on the student’s senate verdict. In the base configuration current level is always increased by 100 no matter which verdict has been assigned.


Increase counter for matric numbers. This counter can be a centrally stored attribute or an attribute of faculties, departments or certificates. In the base package the counter is as an attribute of the site configuration container.

renderPDF(view, filename='slip.pdf', student=None, studentview=None, tableheader=[], tabledata=[], note=None, signatures=None, sigs_in_footer=(), show_scans=True, topMargin=1.5, omit_fields=(), mergefiles=None, watermark=None, pagebreak=False)[source]

Render pdf slips for various pages (also some pages in the applicants module).

renderPDFAdmissionLetter(view, student=None, omit_fields=(), pre_text=None, post_text=None, topMargin=1.5, letterhead_path=None, mergefiles=None, watermark=None)[source]

Render pdf admission letter.

renderPDFCourseticketsOverview(view, name, session, data, lecturers, orientation, title_length, note)[source]

Render pdf slip of course tickets for a lecturer.

renderPDFTranscript(view, filename='transcript.pdf', student=None, studentview=None, note=None, signatures=(), sigs_in_footer=(), digital_sigs=(), show_scans=True, topMargin=1.5, omit_fields=(), tableheader=None, no_passport=False, save_file=False)[source]

Render pdf slip of a transcripts.

samePaymentMade(student, category, p_item, p_session)[source]

Select a bed from a filtered list of available beds. In the base configuration beds are sorted by the sort id of the hostel and the bed number. The first bed found in this sorted list is taken.

setBalanceDetails(category, student, balance_session, balance_level, balance_amount)[source]

Create a balance payment ticket and set the payment data as selected by the student.


Set matriculation number of student. If the student’s matric number is unset a new matric number is constructed according to the matriculation number construction rules defined in the constructMatricNumber method. The new matric number is set, the students catalog updated. The corresponding matric number counter is increased by one.

This method is tested but not used in the base package. It can be used in custom packages by adding respective views and by customizing increaseMatricInteger and constructMatricNumber according to the university’s matriculation number construction rules.

The method can be disabled by setting the counter to zero.

setPaymentDetails(category, student, previous_session=None, previous_level=None, combi=[])[source]

Create a payment ticket and set the payment data of a student for the payment category specified.


Define what happens after school fee payment depending on the student’s senate verdict. This method follows the same algorithm as getReturningData but it also sets the new values.


Udate course tickets if course attributes were changed.

warnCourseAlreadyPassed(studylevel, course)[source]

Return message if course has already been passed at previous levels.

warnCreditsOOR(studylevel, course=None)[source]

Return message if credits are out of range. In the base package only maximum credits is set.

waeup.kofa.students.utils.docs_as_flowables(view, lang='en')[source]

Create reportlab flowables out of scanned docs.

waeup.kofa.students.utils.formatted_text(text, color='black', lang='en')[source]

Turn text, color and size into an HTML snippet.

The snippet is suitable for use with reportlab and generating PDFs. Wraps the text into a <font> tag with passed attributes.

Also non-strings are converted. Raw strings are expected to be utf-8 encoded (usually the case for widgets etc.).

Finally, a br tag is added if widgets contain div tags which are not supported by reportlab.

The returned snippet is unicode type.

waeup.kofa.students.utils.render_student_data(studentview, context, omit_fields=(), lang='en', slipname=None, no_passport=False)[source]

Render student table for an existing frame.

waeup.kofa.students.utils.render_table_data(tableheader, tabledata, lang='en')[source]

Render children table for an existing frame.

waeup.kofa.students.utils.render_transcript_data(view, tableheader, levels_data, lang='en')[source]

Render children table for an existing frame.

waeup.kofa.students.utils.set_up_widgets(view, ignore_request=False)[source]
waeup.kofa.students.utils.trans(text, lang)[source]