[9042] | 1 | ## $Id: export.py 10757 2013-11-18 15:30:05Z 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 | """ |
---|
| 20 | from kofacustom.nigeria.students.interfaces import ( |
---|
[10757] | 21 | INigeriaStudent, INigeriaStudentStudyCourse, INigeriaCourseTicket, |
---|
| 22 | INigeriaStudentOnlinePayment) |
---|
[9042] | 23 | from waeup.kofa.students.export import ( |
---|
[10757] | 24 | StudentsExporter, StudentStudyCourseExporter, CourseTicketExporter, |
---|
| 25 | StudentPaymentsExporter) |
---|
[9042] | 26 | from waeup.kofa.utils.helpers import iface_names |
---|
| 27 | |
---|
| 28 | class NigeriaStudentsExporter(StudentsExporter): |
---|
| 29 | """Exporter for Students. |
---|
| 30 | """ |
---|
| 31 | |
---|
| 32 | #: Fieldnames considered by this exporter |
---|
| 33 | fields = tuple(sorted(iface_names( |
---|
| 34 | INigeriaStudent, omit=['loggerInfo']))) + ( |
---|
[9254] | 35 | 'password', 'state', 'history', 'certcode', 'is_postgrad', |
---|
| 36 | 'current_level', 'current_session') |
---|
[9042] | 37 | |
---|
[9044] | 38 | def mangle_value(self, value, name, context=None): |
---|
| 39 | if '_result' in name and value: |
---|
| 40 | value = [eval(entry.to_string()) for entry in value] |
---|
| 41 | return super( |
---|
| 42 | NigeriaStudentsExporter, self).mangle_value( |
---|
| 43 | value, name, context=context) |
---|
[9042] | 44 | |
---|
| 45 | class NigeriaStudentStudyCourseExporter(StudentStudyCourseExporter): |
---|
| 46 | """Exporter for StudentStudyCourses. |
---|
| 47 | """ |
---|
| 48 | |
---|
| 49 | #: Fieldnames considered by this exporter |
---|
| 50 | fields = tuple( |
---|
| 51 | sorted(iface_names(INigeriaStudentStudyCourse))) + ('student_id',) |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | class NigeriaCourseTicketExporter(CourseTicketExporter): |
---|
| 55 | """Exporter for CourseTickets. |
---|
| 56 | """ |
---|
| 57 | |
---|
| 58 | #: Fieldnames considered by this exporter |
---|
| 59 | fields = tuple(sorted(iface_names(INigeriaCourseTicket) + |
---|
[9860] | 60 | ['level', 'code', 'level_session'])) + ('student_id', 'certcode') |
---|
[10757] | 61 | |
---|
| 62 | class NigeriaStudentPaymentsExporter(StudentPaymentsExporter): |
---|
| 63 | """Exporter for OnlinePayment instances. |
---|
| 64 | """ |
---|
| 65 | |
---|
| 66 | #: Fieldnames considered by this exporter |
---|
| 67 | fields = tuple( |
---|
| 68 | sorted(iface_names( |
---|
| 69 | INigeriaStudentOnlinePayment, exclude_attribs=False, |
---|
| 70 | omit=['display_item']))) + ( |
---|
| 71 | 'student_id','state','current_session') |
---|