students.student - Student Components

Container for the various objects owned by students.

waeup.kofa.students.student.STUDENT_FILE_STORE_NAME = 'file-student'

The file id marker for student files

class waeup.kofa.students.student.Student[source]

Bases: grokcore.content.components.Container

This is a student container for the various objects owned by students.

__doc__ = 'This is a student container for the various objects\n owned by students.\n '
__implemented__ = <implementedBy waeup.kofa.students.student.Student>
__init__()[source]
__module__ = 'waeup.kofa.students.student'
__provides__

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__]
['IFooFactory']
>>> [i.getName() for i in C().__provides__]
['IFoo']
adm_code

PWD Activation Code (computed attribute)

before_payment
certcode
clearance_locked
clr_code

CLR Activation Code (computed attribute)

current_level
current_mode
current_session
current_verdict
date_of_birth

Date of Birth (computed attribute)

depcode
display_fullname
email

Email (computed attribute)

employer

Employer (computed attribute)

entry_mode
entry_session
faccode
firstname

First Name (computed attribute)

flash_notice

Flash Notice (computed attribute)

fullname
getTempPassword()[source]

Check if a temporary password has been set and if it is not expired.

Return the temporary password if valid, None otherwise. Unset the temporary password if expired.

history
is_fresh
is_postgrad
is_special_postgrad
lastname

Last Name (Surname) (computed attribute)

matric_number

Matriculation Number (computed attribute)

middlename

Middle Name (computed attribute)

nationality

Nationality (computed attribute)

officer_comment

Officer’s Comment (computed attribute)

perm_address

Permanent Address (computed attribute)

personal_data_expired
personal_updated

Updated (computed attribute)

phone

Phone (computed attribute)

reg_number

Registration Number (computed attribute)

revert_transfer()[source]

Revert previous transfer.

setTempPassword(user, password)[source]

Set a temporary password (LDAP-compatible) SSHA encoded for officers.

sex

Sex (computed attribute)

state
student
student_id

Student Id (computed attribute)

suspended

Account suspended (computed attribute)

suspended_comment

Reasons for Deactivation (computed attribute)

temp_password_minutes = 10
transcript_comment

Comment (computed attribute)

transcript_enabled
transfer(certificate, current_session=None, current_level=None, current_verdict=None, previous_verdict=None)[source]

Creates a new studycourse and backups the old one.

translated_state
writeLogMessage(view, message)[source]
class waeup.kofa.students.student.StudentFactory[source]

Bases: grokcore.component.components.GlobalUtility

A factory for students.

__call__(*args, **kw)[source]
__doc__ = 'A factory for students.\n '
__implemented__ = <implementedBy waeup.kofa.students.student.StudentFactory>
__module__ = 'waeup.kofa.students.student'
__provides__

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__]
['IFooFactory']
>>> [i.getName() for i in C().__provides__]
['IFoo']
description = u'This factory instantiates new student instances.'
getInterfaces()[source]
title = (u'Create a new student.',)
class waeup.kofa.students.student.StudentFileNameChooser(context)[source]

Bases: grokcore.component.components.Adapter

A file id chooser for Student objects.

context is an Student instance.

The StudentImageNameChooser can build/check file ids for Student objects suitable for use with ExtFileStore instances. The delivered file_id contains the file id marker for Student object and the student id of the context student.

This chooser is registered as an adapter providing waeup.kofa.interfaces.IFileStoreNameChooser.

File store name choosers like this one are only convenience components to ease the task of creating file ids for student objects. You are nevertheless encouraged to use them instead of manually setting up filenames for students.

__doc__ = 'A file id chooser for :class:`Student` objects.\n\n `context` is an :class:`Student` instance.\n\n The :class:`StudentImageNameChooser` can build/check file ids for\n :class:`Student` objects suitable for use with\n :class:`ExtFileStore` instances. The delivered file_id contains\n the file id marker for :class:`Student` object and the student id\n of the context student.\n\n This chooser is registered as an adapter providing\n :class:`waeup.kofa.interfaces.IFileStoreNameChooser`.\n\n File store name choosers like this one are only convenience\n components to ease the task of creating file ids for student\n objects. You are nevertheless encouraged to use them instead of\n manually setting up filenames for students.\n\n .. seealso:: :mod:`waeup.kofa.imagestorage`\n\n '
__implemented__ = <implementedBy waeup.kofa.students.student.StudentFileNameChooser>
__module__ = 'waeup.kofa.students.student'
__provides__

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__]
['IFooFactory']
>>> [i.getName() for i in C().__provides__]
['IFoo']
checkName(name=None, attr=None)[source]

Check whether the given name is a valid file id for the context.

Returns True only if name equals the result of chooseName().

chooseName(attr, name=None)[source]

Get a valid file id for student context.

Example:

For a student with student id 'A123456' and with attr 'nice_image.jpeg' stored in the students container this chooser would create:

'__file-student__students/A/A123456/nice_image_A123456.jpeg'

meaning that the nice image of this applicant would be stored in the site-wide file storage in path:

students/A/A123456/nice_image_A123456.jpeg
class waeup.kofa.students.student.StudentFileStoreHandler[source]

Bases: waeup.kofa.imagestorage.DefaultFileStoreHandler, grokcore.component.components.GlobalUtility

Student specific file handling.

This handler knows in which path in a filestore to store student files and how to turn this kind of data into some (browsable) file object.

It is called from the global file storage, when it wants to get/store a file with a file id starting with __file-student__ (the marker string for student files).

Like each other file store handler it does not handle the files really (this is done by the global file store) but only computes paths and things like this.

__doc__ = 'Student specific file handling.\n\n This handler knows in which path in a filestore to store student\n files and how to turn this kind of data into some (browsable)\n file object.\n\n It is called from the global file storage, when it wants to\n get/store a file with a file id starting with\n ``__file-student__`` (the marker string for student files).\n\n Like each other file store handler it does not handle the files\n really (this is done by the global file store) but only computes\n paths and things like this.\n '
__implemented__ = <implementedBy waeup.kofa.students.student.StudentFileStoreHandler>
__module__ = 'waeup.kofa.students.student'
__provides__

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__]
['IFooFactory']
>>> [i.getName() for i in C().__provides__]
['IFoo']
createFile(store, root, filename, file_id, file)[source]

Create a browsable file-like object.

pathFromFileID(store, root, file_id)[source]

All student files are put in directory students.

waeup.kofa.students.student.handle_student_added(student, event)[source]

If a student is added all subcontainers are automatically added and the transition create is fired. The latter produces a logging message.

waeup.kofa.students.student.handle_student_removed(student, event)[source]
If a student is removed a message is logged and data is put
into a backup location.

The data of the removed student is appended to CSV files in local datacenter and any existing external files (passport images, etc.) are copied over to this location as well.

Documents in the file storage refering to the given student are removed afterwards (if they exist). Please make no assumptions about how the deletion takes place. Files might be deleted individually (leaving the students file directory intact) or the whole student directory might be deleted completely.

All CSV rows created/appended contain a timestamp with the datetime of removal in an additional del_date column.

XXX: blocking of used student_ids yet not implemented.

waeup.kofa.students.student.move_student_files(student, del_dir)[source]

Move files belonging to student to del_dir.

del_dir is expected to be the path to the site-wide directory for storing backup data.

The current files of the student are removed after backup.

If the student has no associated files stored, nothing is done.

waeup.kofa.students.student.path_from_studid(student_id)[source]

Convert a student_id into a predictable relative folder path.

Used for storing files.

Returns the name of folder in which files for a particular student should be stored. This is a relative path, relative to any general students folder with 5 zero-padded digits (except when student_id is overlong).

We normally map 1,000 different student ids into one single path. For instance K1000000 will give 01000/K1000000, K1234567 will give 0123/K1234567 and K12345678 will result in 1234/K12345678.

For lower numbers < 10**6 we return the same path for up to 10,000 student_ids. So for instance KM123456 will result in 00120/KM123456 (there will be no path starting with 00123).

Works also with overlong number: here the leading zeros will be missing but K123456789 will give reliably 12345/K123456789 as expected.

waeup.kofa.students.student.update_student_deletion_csvs(student, del_dir)[source]

Update deletion CSV files with data from student.

del_dir is expected to be the path to the site-wide directory for storing backup data.

Each exporter available for students (and their many subobjects) is called in order to export CSV data of the given student to csv files in the site-wide backup directory for object data (see DataCenter).

Each exported row is appended a column giving the deletion date (column del_date) as a UTC timestamp.