Changeset 12104


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
Files:
7 edited

Legend:

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

    r12075 r12104  
    7171from waeup.kofa.datacenter import DataCenterFile
    7272
    73 from waeup.kofa.students.export import EXPORTER_NAMES as STUDENT_EXPORTERS
    7473from waeup.kofa.students.catalog import StudentQueryResultItem
     74from waeup.kofa.students.interfaces import IStudentsUtils
    7575
    7676FORBIDDEN_CHARACTERS = (160,)
     
    15811581    def getExporters(self):
    15821582        utils = getUtilitiesFor(ICSVExporter)
     1583        STUDENT_EXPORTER_NAMES = getUtility(
     1584            IStudentsUtils).STUDENT_EXPORTER_NAMES
    15831585        title_name_tuples = [
    15841586            (util.title, name) for name, util in utils
    1585             if not name in STUDENT_EXPORTERS]
     1587            if not name in STUDENT_EXPORTER_NAMES]
    15861588        # The exporter for access codes requires a special permission.
    15871589        if not checkPermission('waeup.manageACBatches', self.context):
  • 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``.
  • main/waeup.kofa/trunk/src/waeup/kofa/university/certificate.txt

    r9826 r12104  
    211211     <implementedBy waeup.kofa.university.certificate.CertificateCourse>
    212212
    213 
    214 Event Subscribers
    215 =================
    216 
    217 .. function:: removedCourseHandler(course, event)
    218 
    219    An event subscriber triggered for
    220    :class:`grok.IObjectRemovedEvent`s, when an :class:`ICourse`
    221    instance is removed from a container.
    222 
    223    Tries to remove all referring :class:`CertificateCourse`
    224    instances that refer to a removed course.
    225 
    226    To accomplish that, the parents of the removed course are looked up
    227    for a certifcate container which contains a certificate course that
    228    refers to the deleted course.
    229 
    230    .. seealso:: :ref:`removecertificatecourses`
    231 
    232    **handles:**
    233      :class:`ICourse`
    234 
    235    **event type:**
    236      :class:`grok.IObjectRemovedEvent`
    237213
    238214Examples
Note: See TracChangeset for help on using the changeset viewer.