Ignore:
Timestamp:
1 Dec 2014, 14:43:16 (10 years ago)
Author:
Henrik Bettermann
Message:

Ease customization of STUDENT_EXPORTER_NAMES.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r12048 r12104  
    7676    )
    7777from waeup.kofa.students.catalog import search, StudentQueryResultItem
    78 from waeup.kofa.students.export import EXPORTER_NAMES
    7978from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket
    8079from waeup.kofa.students.vocabularies import StudyLevelSource
     
    31803179            self.exporters = exporters
    31813180            return
    3182         for name in EXPORTER_NAMES:
     3181        STUDENT_EXPORTER_NAMES = getUtility(
     3182            IStudentsUtils).STUDENT_EXPORTER_NAMES
     3183        for name in STUDENT_EXPORTER_NAMES:
    31833184            util = getUtility(ICSVExporter, name=name)
    31843185            exporters.append((util.title, name),)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r12079 r12104  
    3333from waeup.kofa.utils.helpers import iface_names, to_timezone
    3434
    35 #: A tuple containing all exporter names referring to students or
    36 #: subobjects thereof.
    37 EXPORTER_NAMES = ('students', 'studentstudycourses',
    38         'studentstudylevels', 'coursetickets',
    39         'studentpayments', 'bedtickets', 'paymentsoverview',
    40         'studylevelsoverview', 'combocard', 'bursary')
    4135
    4236def get_students(site, stud_filter=StudentsQuery()):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/student.py

    r11604 r12104  
    3939    CREATED, ADMITTED, CLEARANCE, PAID, REGISTERED, VALIDATED, RETURNING)
    4040from waeup.kofa.students.accommodation import StudentAccommodation
    41 from waeup.kofa.students.export import EXPORTER_NAMES
    4241from waeup.kofa.students.interfaces import (
    43     IStudent, IStudentNavigation, IStudentPersonalEdit, ICSVStudentExporter)
     42    IStudent, IStudentNavigation, IStudentPersonalEdit, ICSVStudentExporter,
     43    IStudentsUtils)
    4444from waeup.kofa.students.payments import StudentPaymentsContainer
    4545from waeup.kofa.students.utils import generate_student_id
     
    420420    (column `del_date`) as a UTC timestamp.
    421421    """
    422     for name in EXPORTER_NAMES:
     422
     423    STUDENT_EXPORTER_NAMES = getUtility(
     424        IStudentsUtils).STUDENT_EXPORTER_NAMES
     425
     426    for name in STUDENT_EXPORTER_NAMES:
    423427        exporter = getUtility(ICSVStudentExporter, name=name)
    424428        csv_data = exporter.export_student(student)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_student.py

    r10059 r12104  
    3131from zope.schema.interfaces import RequiredMissing
    3232from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser
    33 from waeup.kofa.students.export import EXPORTER_NAMES
    3433from waeup.kofa.students.student import (
    3534    Student, StudentFactory, handle_student_removed, path_from_studid)
     
    4140    IStudent, IStudentStudyCourse, IStudentPaymentsContainer,
    4241    IStudentAccommodation, IStudentStudyLevel, ICourseTicket, IBedTicket,
    43     IStudentNavigation)
     42    IStudentNavigation, IStudentsUtils)
    4443from waeup.kofa.students.tests.test_batching import StudentImportExportSetup
    4544from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
     
    183182
    184183        # The student data were put into CSV files
    185         for name in EXPORTER_NAMES:
     184        STUDENT_EXPORTER_NAMES = getUtility(
     185            IStudentsUtils).STUDENT_EXPORTER_NAMES
     186
     187        for name in STUDENT_EXPORTER_NAMES:
    186188            csv_path = os.path.join(del_dir, '%s.csv' % name)
    187189            self.assertTrue(os.path.isfile(csv_path))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py

    r12048 r12104  
    936936    PWCHANGE_STATES = (ADMITTED,)
    937937
     938    #: A tuple containing all exporter names referring to students or
     939    #: subobjects thereof.
     940    STUDENT_EXPORTER_NAMES = ('students', 'studentstudycourses',
     941            'studentstudylevels', 'coursetickets',
     942            'studentpayments', 'bedtickets', 'paymentsoverview',
     943            'studylevelsoverview', 'combocard', 'bursary')
     944
    938945    #: A prefix used when generating new student ids. Each student id will
    939946    #: start with this string. The default is 'K' for ``Kofa``.
Note: See TracChangeset for help on using the changeset viewer.