source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/export.py @ 9356

Last change on this file since 9356 was 9256, checked in by Henrik Bettermann, 12 years ago

Uups, number_of_tickets does not make sense for course tickets.

  • Property svn:keywords set to Id
File size: 2.3 KB
RevLine 
[9042]1## $Id: export.py 9256 2012-09-28 13:58:22Z henrik $
2##
3## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Exporters for student related stuff.
19"""
20from kofacustom.nigeria.students.interfaces import (
21    INigeriaStudent, INigeriaStudentStudyCourse, INigeriaCourseTicket)
22from waeup.kofa.students.export import (
23    StudentsExporter, StudentStudyCourseExporter, CourseTicketExporter)
24from waeup.kofa.utils.helpers import iface_names
25
26class NigeriaStudentsExporter(StudentsExporter):
27    """Exporter for Students.
28    """
29
30    #: Fieldnames considered by this exporter
31    fields = tuple(sorted(iface_names(
32        INigeriaStudent, omit=['loggerInfo']))) + (
[9254]33        'password', 'state', 'history', 'certcode', 'is_postgrad',
34        'current_level', 'current_session')
[9042]35
[9044]36    def mangle_value(self, value, name, context=None):
37        if '_result' in name and value:
38            value = [eval(entry.to_string()) for entry in value]
39        return super(
40            NigeriaStudentsExporter, self).mangle_value(
41            value, name, context=context)
[9042]42
43class NigeriaStudentStudyCourseExporter(StudentStudyCourseExporter):
44    """Exporter for StudentStudyCourses.
45    """
46
47    #: Fieldnames considered by this exporter
48    fields = tuple(
49        sorted(iface_names(INigeriaStudentStudyCourse))) + ('student_id',)
50
51
52class NigeriaCourseTicketExporter(CourseTicketExporter):
53    """Exporter for CourseTickets.
54    """
55
56    #: Fieldnames considered by this exporter
57    fields = tuple(sorted(iface_names(INigeriaCourseTicket) +
58        ['level', 'code', 'title', 'credits',
[9254]59        'passmark', 'semester', 'fcode', 'dcode'])) + (
[9256]60        'student_id', 'certcode')
Note: See TracBrowser for help on using the repository browser.