Changeset 7933 for main


Ignore:
Timestamp:
21 Mar 2012, 13:42:00 (13 years ago)
Author:
Henrik Bettermann
Message:

Rename importers to processors.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py

    r7811 r7933  
    3030    IApplicantsContainer, IApplicant, IApplicantUpdateByRegNo)
    3131
    32 class ApplicantsContainerImporter(BatchProcessor):
    33     """An importer for applicants containers.
     32class ApplicantsContainerProcessor(BatchProcessor):
     33    """A processor for applicants containers.
    3434    """
    3535    grok.implements(IBatchProcessor)
    3636    grok.provides(IBatchProcessor)
    3737    grok.context(Interface)
    38     util_name = 'applicants container importer'
     38    util_name = 'applicants container processor'
    3939    grok.name(util_name)
    4040
    41     name = u'Applicants Container Importer'
     41    name = u'Applicants Container Processor'
    4242    mode = u'create'
    4343    iface = IApplicantsContainer
     
    7171        return
    7272
    73 class ApplicantImporter(BatchProcessor):
     73class ApplicantProcessor(BatchProcessor):
    7474    """A batch processor for IApplicant objects.
    7575    """
     
    7777    grok.provides(IBatchProcessor)
    7878    grok.context(Interface)
    79     util_name = 'applicantimporter'
     79    util_name = 'applicantprocessor'
    8080    grok.name(util_name)
    81     name = u'Applicant Importer'
     81    name = u'Applicant Processor'
    8282    iface = IApplicant
    8383    location_fields = []
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/interfaces.py

    r7915 r7933  
    354354
    355355    This is a base interface with no field
    356     required. For use with importers, forms, etc., please use one of
     356    required. For use with processors, forms, etc., please use one of
    357357    the derived interfaces below, which set more fields to required
    358358    state, depending on use-case.
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py

    r7912 r7933  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
    18 """Unit tests for applicants-related data importers.
     18"""Unit tests for applicants-related data processors.
    1919"""
    2020import datetime
     
    2929from waeup.kofa.app import University
    3030from waeup.kofa.applicants.batching import (
    31     ApplicantsContainerImporter, ApplicantImporter)
     31    ApplicantsContainerProcessor, ApplicantProcessor)
    3232from waeup.kofa.applicants.container import ApplicantsContainer
    3333from waeup.kofa.applicants.applicant import Applicant
     
    6666    '\n')[0].split(',')
    6767
    68 class ApplicantsContainerImporterTest(FunctionalTestCase):
     68class ApplicantsContainerProcessorTest(FunctionalTestCase):
    6969
    7070    layer = FunctionalLayer
    7171
    7272    def setUp(self):
    73         super(ApplicantsContainerImporterTest, self).setUp()
     73        super(ApplicantsContainerProcessorTest, self).setUp()
    7474
    7575        # Setup a sample site for each test
     
    8585        self.app['applicants']['dp2011'] = self.container
    8686
    87         self.importer = ApplicantsContainerImporter()
     87        self.processor = ApplicantsContainerProcessor()
    8888        self.workdir = tempfile.mkdtemp()
    8989        self.csv_file = os.path.join(self.workdir, 'sampledata.csv')
     
    9393
    9494    def tearDown(self):
    95         super(ApplicantsContainerImporterTest, self).tearDown()
     95        super(ApplicantsContainerProcessorTest, self).tearDown()
    9696        shutil.rmtree(self.workdir)
    9797        shutil.rmtree(self.dc_root)
     
    101101    def test_interface(self):
    102102        # Make sure we fulfill the interface contracts.
    103         assert verifyObject(IBatchProcessor, self.importer) is True
     103        assert verifyObject(IBatchProcessor, self.processor) is True
    104104        assert verifyClass(
    105             IBatchProcessor, ApplicantsContainerImporter) is True
     105            IBatchProcessor, ApplicantsContainerProcessor) is True
    106106
    107107    def test_parentsExist(self):
    108         assert self.importer.parentsExist(None, dict()) is False
    109         assert self.importer.parentsExist(None, self.app) is True
     108        assert self.processor.parentsExist(None, dict()) is False
     109        assert self.processor.parentsExist(None, self.app) is True
    110110
    111111    def test_entryExists(self):
    112         assert self.importer.entryExists(
     112        assert self.processor.entryExists(
    113113            dict(code='REG_NONE'), self.app) is False
    114         assert self.importer.entryExists(
     114        assert self.processor.entryExists(
    115115            dict(code='dp2011'), self.app) is True
    116116
    117117    def test_getParent(self):
    118         parent = self.importer.getParent(None, self.app)
     118        parent = self.processor.getParent(None, self.app)
    119119        assert parent is self.app['applicants']
    120120
    121121    def test_getEntry(self):
    122         assert self.importer.getEntry(
     122        assert self.processor.getEntry(
    123123            dict(code='REG_NONE'), self.app) is None
    124         assert self.importer.getEntry(
     124        assert self.processor.getEntry(
    125125            dict(code='dp2011'), self.app) is self.container
    126126
    127127    def test_addEntry(self):
    128         self.importer.addEntry(
     128        self.processor.addEntry(
    129129            'New application', dict(code='dp2012'), self.app)
    130130        assert self.app['applicants']['dp2012'] == 'New application'
    131131
    132132    def test_delEntry(self):
    133         self.importer.delEntry(dict(code='dp2011'), self.app)
     133        self.processor.delEntry(dict(code='dp2011'), self.app)
    134134        assert 'dp2011' not in self.app['applicants'].keys()
    135135
     
    137137        # Do a real import
    138138        # see local sample_container.csv file for input
    139         num, num_warns, fin_file, fail_file = self.importer.doImport(
     139        num, num_warns, fin_file, fail_file = self.processor.doImport(
    140140            self.csv_file, APPS_CONTAINER_HEADER_FIELDS)
    141141        avail_containers = [x for x in self.app['applicants'].keys()]
     
    219219        return
    220220
    221 class ApplicantImporterTest(ApplicantImportExportSetup):
     221class ApplicantProcessorTest(ApplicantImportExportSetup):
    222222
    223223    layer = FunctionalLayer
    224224
    225225    def setUp(self):
    226         super(ApplicantImporterTest, self).setUp()
    227         self.importer = ApplicantImporter()
     226        super(ApplicantProcessorTest, self).setUp()
     227        self.processor = ApplicantProcessor()
    228228        self.csv_file = os.path.join(self.workdir, 'sample_applicant_data.csv')
    229229        self.csv_file_faulty = os.path.join(self.workdir,
     
    237237    def test_interface(self):
    238238        # Make sure we fulfill the interface contracts.
    239         assert verifyObject(IBatchProcessor, self.importer) is True
     239        assert verifyObject(IBatchProcessor, self.processor) is True
    240240        assert verifyClass(
    241             IBatchProcessor, ApplicantImporter) is True
     241            IBatchProcessor, ApplicantProcessor) is True
    242242
    243243    def test_entryExists(self):
    244         assert self.importer.entryExists(
     244        assert self.processor.entryExists(
    245245            dict(container_code='dp2011', application_number='999'),
    246246            self.app) is False
    247247
    248248    def test_getEntry(self):
    249         applicant = self.importer.getEntry(
     249        applicant = self.processor.getEntry(
    250250            dict(container_code='dp2011',
    251251                 application_number=self.application_number), self.app)
     
    254254    def test_addEntry(self):
    255255        new_applicant = Applicant()
    256         self.importer.addEntry(
     256        self.processor.addEntry(
    257257            new_applicant, dict(container_code='dp2011'), self.app)
    258258        assert len(self.app['applicants']['dp2011'].keys()) == 2
     
    261261        assert self.application_number in self.app[
    262262            'applicants']['dp2011'].keys()
    263         self.importer.delEntry(
     263        self.processor.delEntry(
    264264            dict(container_code='dp2011',
    265265                application_number=self.application_number), self.app)
     
    268268
    269269    def test_import(self):
    270         num, num_warns, fin_file, fail_file = self.importer.doImport(
     270        num, num_warns, fin_file, fail_file = self.processor.doImport(
    271271            self.csv_file, APPLICANT_HEADER_FIELDS)
    272272        self.assertEqual(num_warns,0)
     
    285285        # when in format xx/yy/zzzz as we cannot say whether it is
    286286        # meant as dd/mm/yyyy or mm/dd/yyyy. We therefore require yyyy-mm-dd
    287         num, num_warns, fin_file, fail_file = self.importer.doImport(
     287        num, num_warns, fin_file, fail_file = self.processor.doImport(
    288288            self.csv_file_faulty, APPLICANT_HEADER_FIELDS)
    289289        if fail_file is not None:
     
    300300
    301301    def test_import_update(self):
    302         num, num_warns, fin_file, fail_file = self.importer.doImport(
     302        num, num_warns, fin_file, fail_file = self.processor.doImport(
    303303            self.csv_file, APPLICANT_HEADER_FIELDS)
    304304        shutil.rmtree(os.path.dirname(fin_file))
    305         num, num_warns, fin_file, fail_file = self.importer.doImport(
     305        num, num_warns, fin_file, fail_file = self.processor.doImport(
    306306            self.csv_file_update, APPLICANT_HEADER_FIELDS_UPDATE, 'update')
    307307        self.assertEqual(num_warns,0)
     
    309309
    310310    def test_import_remove(self):
    311         num, num_warns, fin_file, fail_file = self.importer.doImport(
     311        num, num_warns, fin_file, fail_file = self.processor.doImport(
    312312            self.csv_file, APPLICANT_HEADER_FIELDS)
    313313        shutil.rmtree(os.path.dirname(fin_file))
    314         num, num_warns, fin_file, fail_file = self.importer.doImport(
     314        num, num_warns, fin_file, fail_file = self.processor.doImport(
    315315            self.csv_file_update, APPLICANT_HEADER_FIELDS_UPDATE, 'remove')
    316316        self.assertEqual(num_warns,0)
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt

    r7811 r7933  
    9393    >>> importerselect = browser.getControl(name='importer')
    9494    >>> importerselect.displayOptions
    95     ['Applicant Importer',
    96      'Applicants Container Importer',
    97      'CourseTicket Importer',
    98      'Payment Importer',
    99      'Student Importer',
    100      'StudentStudyCourse Importer (update only)',
    101      'StudentStudyLevel Importer',
    102      'CertificateCourse Importer',
    103      'Certificate Importer',
    104      'Course Importer',
    105      'Department Importer',
    106      'Faculty Importer']
    107 
    108     >>> importerselect.getControl('Faculty Importer').selected = True
     95    ['Applicant Processor',
     96     'Applicants Container Processor',
     97     'CourseTicket Processor',
     98     'Payment Processor',
     99     'Student Processor',
     100     'StudentStudyCourse Processor (update only)',
     101     'StudentStudyLevel Processor',
     102     'CertificateCourse Processor',
     103     'Certificate Processor',
     104     'Course Processor',
     105     'Department Processor',
     106     'Faculty Processor']
     107
     108    >>> importerselect.getControl('Faculty Processor').selected = True
    109109
    110110    >>> modeselect = browser.getControl(name='mode')
     
    197197
    198198    >>> importerselect = browser.getControl(name='importer')
    199     >>> importerselect.getControl('Department Importer').selected = True
     199    >>> importerselect.getControl('Department Processor').selected = True
    200200    >>> modeselect = browser.getControl(name='mode')
    201201    >>> modeselect.getControl(value='create').selected = True
     
    262262
    263263    >>> importerselect = browser.getControl(name='importer')
    264     >>> importerselect.getControl('Course Importer', index=2).selected = True
     264    >>> importerselect.getControl('Course Processor', index=2).selected = True
    265265    >>> modeselect = browser.getControl(name='mode')
    266266    >>> modeselect.getControl(value='create').selected = True
     
    328328
    329329    >>> importerselect = browser.getControl(name='importer')
    330     >>> importerselect.getControl('Certificate Importer').selected = True
     330    >>> importerselect.getControl('Certificate Processor').selected = True
    331331    >>> modeselect = browser.getControl(name='mode')
    332332    >>> modeselect.getControl(value='create').selected = True
     
    393393
    394394    >>> importerselect = browser.getControl(name='importer')
    395     >>> importerselect.getControl('CertificateCourse Importer').selected = True
     395    >>> importerselect.getControl('CertificateCourse Processor').selected = True
    396396    >>> modeselect = browser.getControl(name='mode')
    397397    >>> modeselect.getControl(value='create').selected = True
     
    466466
    467467    >>> importerselect = browser.getControl(name='importer')
    468     >>> importerselect.getControl('Faculty Importer').selected = True
     468    >>> importerselect.getControl('Faculty Processor').selected = True
    469469    >>> modeselect = browser.getControl(name='mode')
    470470    >>> modeselect.getControl(value='create').selected = True
     
    528528
    529529    >>> importerselect = browser.getControl(name='importer')
    530     >>> importerselect.getControl('Faculty Importer').selected = True
     530    >>> importerselect.getControl('Faculty Processor').selected = True
    531531    >>> modeselect = browser.getControl(name='mode')
    532532    >>> modeselect.getControl(value='create').selected = True
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r7908 r7933  
    829829
    830830class DatacenterImportStep2(KofaPage):
    831     """Manual import step 2: choose importer
     831    """Manual import step 2: choose processor
    832832    """
    833833    grok.context(IDataCenter)
  • main/waeup.kofa/trunk/src/waeup/kofa/datacenter.py

    r7819 r7933  
    133133        If finished file is placed in a location outside the local
    134134        storage dir, the complete directory is removed
    135         afterwards. Regular importers should put their stuff in
     135        afterwards. Regular processors should put their stuff in
    136136        dedicated temporary dirs.
    137137
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r7932 r7933  
    321321    """
    322322    name = schema.TextLine(
    323         title = _(u'Importer name')
     323        title = _(u'Processor name')
    324324        )
    325325
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r7811 r7933  
    4949    grok.provides(IBatchProcessor)
    5050    grok.context(Interface)
    51     util_name = 'studentimporter'
     51    util_name = 'studentprocessor'
    5252    grok.name(util_name)
    5353
    54     name = u'Student Importer'
     54    name = u'Student Processor'
    5555    iface = IStudent
    5656
     
    223223    grok.name(util_name)
    224224
    225     name = u'StudentStudyCourse Importer (update only)'
     225    name = u'StudentStudyCourse Processor (update only)'
    226226    iface = IStudentStudyCourse
    227227    factory_name = 'waeup.StudentStudyCourse'
     
    330330    grok.provides(IBatchProcessor)
    331331    grok.context(Interface)
    332     util_name = 'studylevelimporter'
     332    util_name = 'studylevelprocessor'
    333333    grok.name(util_name)
    334334
    335     name = u'StudentStudyLevel Importer'
     335    name = u'StudentStudyLevel Processor'
    336336    iface = IStudentStudyLevel
    337337    factory_name = 'waeup.StudentStudyLevel'
     
    427427    grok.provides(IBatchProcessor)
    428428    grok.context(Interface)
    429     util_name = 'courseticketimporter'
     429    util_name = 'courseticketprocessor'
    430430    grok.name(util_name)
    431431
    432     name = u'CourseTicket Importer'
     432    name = u'CourseTicket Processor'
    433433    iface = ICourseTicket
    434434    factory_name = 'waeup.CourseTicket'
     
    533533    grok.provides(IBatchProcessor)
    534534    grok.context(Interface)
    535     util_name = 'paymentimporter'
     535    util_name = 'paymentprocessor'
    536536    grok.name(util_name)
    537537
    538     name = u'Payment Importer'
     538    name = u'Payment Processor'
    539539    iface = IStudentOnlinePayment
    540540    factory_name = 'waeup.StudentOnlinePayment'
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r7811 r7933  
    1616## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1717##
    18 """Unit tests for students-related data importers.
     18"""Unit tests for students-related data processors.
    1919"""
    2020import os
     
    9595    '\n')[0].split(',')
    9696
    97 class StudentImporterTest(FunctionalTestCase):
     97class StudentProcessorTest(FunctionalTestCase):
    9898
    9999    layer = FunctionalLayer
    100100
    101101    def setUp(self):
    102         super(StudentImporterTest, self).setUp()
     102        super(StudentProcessorTest, self).setUp()
    103103        # Setup a sample site for each test
    104104        app = University()
     
    124124        self.app['students'].addStudent(student)
    125125        self.student = self.app['students'][student.student_id]
    126         self.importer = StudentProcessor()
     126        self.processor = StudentProcessor()
    127127        self.workdir = tempfile.mkdtemp()
    128128        self.csv_file = os.path.join(self.workdir, 'sample_student_data.csv')
     
    139139
    140140    def tearDown(self):
    141         super(StudentImporterTest, self).tearDown()
     141        super(StudentProcessorTest, self).tearDown()
    142142        shutil.rmtree(self.workdir)
    143143        shutil.rmtree(self.dc_root)
     
    147147    def test_interface(self):
    148148        # Make sure we fulfill the interface contracts.
    149         assert verifyObject(IBatchProcessor, self.importer) is True
     149        assert verifyObject(IBatchProcessor, self.processor) is True
    150150        assert verifyClass(
    151151            IBatchProcessor, StudentProcessor) is True
    152152
    153153    def test_parentsExist(self):
    154         self.assertFalse(self.importer.parentsExist(None, dict()))
    155         self.assertTrue(self.importer.parentsExist(None, self.app))
     154        self.assertFalse(self.processor.parentsExist(None, dict()))
     155        self.assertTrue(self.processor.parentsExist(None, self.app))
    156156
    157157    def test_entryExists(self):
    158         assert self.importer.entryExists(
     158        assert self.processor.entryExists(
    159159            dict(student_id='ID_NONE'), self.app) is False
    160         assert self.importer.entryExists(
     160        assert self.processor.entryExists(
    161161            dict(reg_number='123'), self.app) is True
    162162
    163163    def test_getParent(self):
    164         parent = self.importer.getParent(None, self.app)
     164        parent = self.processor.getParent(None, self.app)
    165165        assert parent is self.app['students']
    166166
    167167    def test_getEntry(self):
    168         assert self.importer.getEntry(
     168        assert self.processor.getEntry(
    169169            dict(student_id='ID_NONE'), self.app) is None
    170         assert self.importer.getEntry(
     170        assert self.processor.getEntry(
    171171            dict(student_id=self.student.student_id), self.app) is self.student
    172172
    173173    def test_addEntry(self):
    174174        new_student = Student()
    175         self.importer.addEntry(
     175        self.processor.addEntry(
    176176            new_student, dict(), self.app)
    177177        assert len(self.app['students'].keys()) == 2
    178178
    179179    def test_checkConversion(self):
    180         errs, inv_errs, conv_dict = self.importer.checkConversion(
     180        errs, inv_errs, conv_dict = self.processor.checkConversion(
    181181            dict(reg_number='1', reg_state='admitted'))
    182182        self.assertEqual(len(errs),0)
    183         errs, inv_errs, conv_dict = self.importer.checkConversion(
     183        errs, inv_errs, conv_dict = self.processor.checkConversion(
    184184            dict(reg_number='1', reg_state=''))
    185185        self.assertEqual(len(errs),1)
    186186        self.assertTrue(('reg_state', 'no value provided') in errs)
    187         errs, inv_errs, conv_dict = self.importer.checkConversion(
     187        errs, inv_errs, conv_dict = self.processor.checkConversion(
    188188            dict(reg_number='1', reg_state='nonsense'))
    189189        self.assertEqual(len(errs),1)
     
    192192    def test_delEntry(self):
    193193        assert self.student.student_id in self.app['students'].keys()
    194         self.importer.delEntry(
     194        self.processor.delEntry(
    195195            dict(reg_number=self.student.reg_number), self.app)
    196196        assert self.student.student_id not in self.app['students'].keys()
    197197
    198198    def test_import(self):
    199         num, num_warns, fin_file, fail_file = self.importer.doImport(
     199        num, num_warns, fin_file, fail_file = self.processor.doImport(
    200200            self.csv_file, STUDENT_HEADER_FIELDS)
    201201        self.assertEqual(num_warns,0)
     
    205205
    206206    def test_import_update(self):
    207         num, num_warns, fin_file, fail_file = self.importer.doImport(
     207        num, num_warns, fin_file, fail_file = self.processor.doImport(
    208208            self.csv_file, STUDENT_HEADER_FIELDS)
    209209        shutil.rmtree(os.path.dirname(fin_file))
    210         num, num_warns, fin_file, fail_file = self.importer.doImport(
     210        num, num_warns, fin_file, fail_file = self.processor.doImport(
    211211            self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'update')
    212212        self.assertEqual(num_warns,0)
     
    214214
    215215    def test_import_update2(self):
    216         num, num_warns, fin_file, fail_file = self.importer.doImport(
     216        num, num_warns, fin_file, fail_file = self.processor.doImport(
    217217            self.csv_file, STUDENT_HEADER_FIELDS)
    218218        shutil.rmtree(os.path.dirname(fin_file))
    219         num, num_warns, fin_file, fail_file = self.importer.doImport(
     219        num, num_warns, fin_file, fail_file = self.processor.doImport(
    220220            self.csv_file_update2, STUDENT_HEADER_FIELDS_UPDATE2, 'update')
    221221        self.assertEqual(num_warns,0)
     
    223223
    224224    def test_import_remove(self):
    225         num, num_warns, fin_file, fail_file = self.importer.doImport(
     225        num, num_warns, fin_file, fail_file = self.processor.doImport(
    226226            self.csv_file, STUDENT_HEADER_FIELDS)
    227227        shutil.rmtree(os.path.dirname(fin_file))
    228         num, num_warns, fin_file, fail_file = self.importer.doImport(
     228        num, num_warns, fin_file, fail_file = self.processor.doImport(
    229229            self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'remove')
    230230        self.assertEqual(num_warns,0)
     
    232232
    233233    def test_import_migration_data(self):
    234         num, num_warns, fin_file, fail_file = self.importer.doImport(
     234        num, num_warns, fin_file, fail_file = self.processor.doImport(
    235235            self.csv_file_migration, STUDENT_HEADER_FIELDS_MIGRATION)
    236236        self.assertEqual(num_warns,2)
     
    251251
    252252
    253 class StudentStudyCourseImporterTest(FunctionalTestCase):
     253class StudentStudyCourseProcessorTest(FunctionalTestCase):
    254254
    255255    layer = FunctionalLayer
    256256
    257257    def setUp(self):
    258         super(StudentStudyCourseImporterTest, self).setUp()
     258        super(StudentStudyCourseProcessorTest, self).setUp()
    259259        self.dc_root = tempfile.mkdtemp()
    260260        self.workdir = tempfile.mkdtemp()
     
    283283            self.certificate)
    284284
    285         self.importer = StudentStudyCourseProcessor()
     285        self.processor = StudentStudyCourseProcessor()
    286286        self.csv_file = os.path.join(
    287287            self.workdir, 'sample_studycourse_data.csv')
     
    290290
    291291    def tearDown(self):
    292         super(StudentStudyCourseImporterTest, self).tearDown()
     292        super(StudentStudyCourseProcessorTest, self).tearDown()
    293293        shutil.rmtree(self.workdir)
    294294        shutil.rmtree(self.dc_root)
     
    298298    def test_interface(self):
    299299        # Make sure we fulfill the interface contracts.
    300         assert verifyObject(IBatchProcessor, self.importer) is True
     300        assert verifyObject(IBatchProcessor, self.processor) is True
    301301        assert verifyClass(
    302302            IBatchProcessor, StudentStudyCourseProcessor) is True
    303303
    304304    def test_entryExists(self):
    305         assert self.importer.entryExists(
     305        assert self.processor.entryExists(
    306306            dict(reg_number='REG_NONE'), self.app) is False
    307         assert self.importer.entryExists(
     307        assert self.processor.entryExists(
    308308            dict(reg_number='1'), self.app) is True
    309309
    310310    def test_getEntry(self):
    311         student = self.importer.getEntry(
     311        student = self.processor.getEntry(
    312312            dict(reg_number='1'), self.app).__parent__
    313313        self.assertEqual(student.reg_number,'1')
    314314
    315315    def test_checkConversion(self):
    316         errs, inv_errs, conv_dict = self.importer.checkConversion(
     316        errs, inv_errs, conv_dict = self.processor.checkConversion(
    317317            dict(reg_number='1', certificate='CERT1', current_level='200'))
    318318        self.assertEqual(len(errs),0)
    319         errs, inv_errs, conv_dict = self.importer.checkConversion(
     319        errs, inv_errs, conv_dict = self.processor.checkConversion(
    320320            dict(reg_number='1', certificate='CERT999'))
    321321        self.assertEqual(len(errs),1)
    322322        self.assertTrue(('certificate', u'Invalid value') in errs)
    323         errs, inv_errs, conv_dict = self.importer.checkConversion(
     323        errs, inv_errs, conv_dict = self.processor.checkConversion(
    324324            dict(reg_number='1', certificate='CERT1', current_level='100'))
    325325        self.assertEqual(len(errs),1)
    326326        self.assertTrue(('current_level','not in range') in errs)
    327327        # If we import only current_level, no conversion checking is done.
    328         errs, inv_errs, conv_dict = self.importer.checkConversion(
     328        errs, inv_errs, conv_dict = self.processor.checkConversion(
    329329            dict(reg_number='1', current_level='100'))
    330330        self.assertEqual(len(errs),0)
    331331
    332332    def test_import(self):
    333         num, num_warns, fin_file, fail_file = self.importer.doImport(
     333        num, num_warns, fin_file, fail_file = self.processor.doImport(
    334334            self.csv_file, STUDYCOURSE_HEADER_FIELDS,'update')
    335335        self.assertEqual(num_warns,1)
    336         studycourse = self.importer.getEntry(dict(reg_number='1'), self.app)
     336        studycourse = self.processor.getEntry(dict(reg_number='1'), self.app)
    337337        self.assertEqual(studycourse.certificate.code, u'CERT1')
    338338        shutil.rmtree(os.path.dirname(fin_file))
    339339
    340 class StudentStudyLevelImporterTest(FunctionalTestCase):
     340class StudentStudyLevelProcessorTest(FunctionalTestCase):
    341341
    342342    layer = FunctionalLayer
    343343
    344344    def setUp(self):
    345         super(StudentStudyLevelImporterTest, self).setUp()
     345        super(StudentStudyLevelProcessorTest, self).setUp()
    346346        self.dc_root = tempfile.mkdtemp()
    347347        self.workdir = tempfile.mkdtemp()
     
    374374            self.workdir, 'sample_studycourse_data.csv')
    375375        open(studycourse_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
    376         importer = StudentStudyCourseProcessor()
    377         num, num_warns, fin_file, fail_file = importer.doImport(
     376        processor = StudentStudyCourseProcessor()
     377        num, num_warns, fin_file, fail_file = processor.doImport(
    378378            studycourse_file, STUDYCOURSE_HEADER_FIELDS,'update')
    379379        shutil.rmtree(os.path.dirname(fin_file))
    380380
    381         self.importer = StudentStudyLevelProcessor()
     381        self.processor = StudentStudyLevelProcessor()
    382382        self.csv_file = os.path.join(
    383383            self.workdir, 'sample_studylevel_data.csv')
     
    385385
    386386    def tearDown(self):
    387         super(StudentStudyLevelImporterTest, self).tearDown()
     387        super(StudentStudyLevelProcessorTest, self).tearDown()
    388388        shutil.rmtree(self.workdir)
    389389        shutil.rmtree(self.dc_root)
     
    393393    def test_interface(self):
    394394        # Make sure we fulfill the interface contracts.
    395         assert verifyObject(IBatchProcessor, self.importer) is True
     395        assert verifyObject(IBatchProcessor, self.processor) is True
    396396        assert verifyClass(
    397397            IBatchProcessor, StudentStudyLevelProcessor) is True
    398398
    399399    def test_checkConversion(self):
    400         errs, inv_errs, conv_dict = self.importer.checkConversion(
     400        errs, inv_errs, conv_dict = self.processor.checkConversion(
    401401            dict(reg_number='1', level='220'))
    402402        self.assertEqual(len(errs),0)
    403         errs, inv_errs, conv_dict = self.importer.checkConversion(
     403        errs, inv_errs, conv_dict = self.processor.checkConversion(
    404404            dict(reg_number='1', level='900'))
    405405        self.assertEqual(len(errs),1)
    406406        self.assertTrue(('level','no valid integer') in errs)
    407         errs, inv_errs, conv_dict = self.importer.checkConversion(
     407        errs, inv_errs, conv_dict = self.processor.checkConversion(
    408408            dict(reg_number='1', level='xyz'))
    409409        self.assertEqual(len(errs),1)
     
    411411
    412412    def test_import(self):
    413         num, num_warns, fin_file, fail_file = self.importer.doImport(
     413        num, num_warns, fin_file, fail_file = self.processor.doImport(
    414414            self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
    415415        self.assertEqual(num_warns,2)
    416         assert self.importer.entryExists(
     416        assert self.processor.entryExists(
    417417            dict(reg_number='1', level='100'), self.app) is True
    418         studylevel = self.importer.getEntry(
     418        studylevel = self.processor.getEntry(
    419419            dict(reg_number='1', level='100'), self.app)
    420420        self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1')
     
    425425       
    426426
    427 class CourseTicketImporterTest(FunctionalTestCase):
     427class CourseTicketProcessorTest(FunctionalTestCase):
    428428
    429429    layer = FunctionalLayer
    430430
    431431    def setUp(self):
    432         super(CourseTicketImporterTest, self).setUp()
     432        super(CourseTicketProcessorTest, self).setUp()
    433433        self.dc_root = tempfile.mkdtemp()
    434434        self.workdir = tempfile.mkdtemp()
     
    470470            self.workdir, 'sample_studycourse_data.csv')
    471471        open(studycourse_file, 'wb').write(STUDYCOURSE_SAMPLE_DATA)
    472         importer = StudentStudyCourseProcessor()
    473         num, num_warns, fin_file, fail_file = importer.doImport(
     472        processor = StudentStudyCourseProcessor()
     473        num, num_warns, fin_file, fail_file = processor.doImport(
    474474            studycourse_file, STUDYCOURSE_HEADER_FIELDS,'update')
    475475        shutil.rmtree(os.path.dirname(fin_file))
    476476
    477477        # Import study levels
    478         importer = StudentStudyLevelProcessor()
     478        processor = StudentStudyLevelProcessor()
    479479        studylevel_file = os.path.join(
    480480            self.workdir, 'sample_studylevel_data.csv')
    481481        open(studylevel_file, 'wb').write(STUDYLEVEL_SAMPLE_DATA)
    482         num, num_warns, fin_file, fail_file = importer.doImport(
     482        num, num_warns, fin_file, fail_file = processor.doImport(
    483483            studylevel_file, STUDYLEVEL_HEADER_FIELDS,'create')
    484484        shutil.rmtree(os.path.dirname(fin_file))
    485485
    486         self.importer = CourseTicketProcessor()
     486        self.processor = CourseTicketProcessor()
    487487        self.csv_file = os.path.join(
    488488            self.workdir, 'sample_courseticket_data.csv')
     
    490490
    491491    def tearDown(self):
    492         super(CourseTicketImporterTest, self).tearDown()
     492        super(CourseTicketProcessorTest, self).tearDown()
    493493        shutil.rmtree(self.workdir)
    494494        shutil.rmtree(self.dc_root)
     
    498498    def test_interface(self):
    499499        # Make sure we fulfill the interface contracts.
    500         assert verifyObject(IBatchProcessor, self.importer) is True
     500        assert verifyObject(IBatchProcessor, self.processor) is True
    501501        assert verifyClass(
    502502            IBatchProcessor, CourseTicketProcessor) is True
    503503
    504504    def test_checkConversion(self):
    505         errs, inv_errs, conv_dict = self.importer.checkConversion(
     505        errs, inv_errs, conv_dict = self.processor.checkConversion(
    506506            dict(reg_number='1', code='COURSE1', level='220'))
    507507        self.assertEqual(len(errs),0)
    508         errs, inv_errs, conv_dict = self.importer.checkConversion(
     508        errs, inv_errs, conv_dict = self.processor.checkConversion(
    509509            dict(reg_number='1', code='COURSE2', level='220'))
    510510        self.assertEqual(len(errs),1)
     
    513513    def test_import(self):
    514514
    515         num, num_warns, fin_file, fail_file = self.importer.doImport(
     515        num, num_warns, fin_file, fail_file = self.processor.doImport(
    516516            self.csv_file, COURSETICKET_HEADER_FIELDS,'create')
    517517
    518518        self.assertEqual(num_warns,2)
    519         assert self.importer.entryExists(
     519        assert self.processor.entryExists(
    520520            dict(reg_number='1', level='100', code='COURSE1'), self.app) is True
    521         courseticket = self.importer.getEntry(
     521        courseticket = self.processor.getEntry(
    522522            dict(reg_number='1', level='100', code='COURSE1'), self.app)
    523523        self.assertEqual(courseticket.__parent__.__parent__.certificate.code, u'CERT1')
     
    533533        shutil.rmtree(os.path.dirname(fin_file))
    534534
    535 class PaymentImporterTest(FunctionalTestCase):
     535class PaymentProcessorTest(FunctionalTestCase):
    536536
    537537    layer = FunctionalLayer
    538538
    539539    def setUp(self):
    540         super(PaymentImporterTest, self).setUp()
     540        super(PaymentProcessorTest, self).setUp()
    541541        self.dc_root = tempfile.mkdtemp()
    542542        self.workdir = tempfile.mkdtemp()
     
    566566        shutil.rmtree(os.path.dirname(fin_file))
    567567
    568         self.importer = StudentOnlinePaymentProcessor()
     568        self.processor = StudentOnlinePaymentProcessor()
    569569        self.csv_file = os.path.join(
    570570            self.workdir, 'sample_payment_data.csv')
     
    572572
    573573    def tearDown(self):
    574         super(PaymentImporterTest, self).tearDown()
     574        super(PaymentProcessorTest, self).tearDown()
    575575        shutil.rmtree(self.workdir)
    576576        shutil.rmtree(self.dc_root)
     
    580580    def test_interface(self):
    581581        # Make sure we fulfill the interface contracts.
    582         assert verifyObject(IBatchProcessor, self.importer) is True
     582        assert verifyObject(IBatchProcessor, self.processor) is True
    583583        assert verifyClass(
    584584            IBatchProcessor, StudentOnlinePaymentProcessor) is True
    585585
    586586    def test_getEntry(self):
    587         assert self.importer.getEntry(
     587        assert self.processor.getEntry(
    588588            dict(student_id='ID_NONE', p_id='nonsense'), self.app) is None
    589         assert self.importer.getEntry(
     589        assert self.processor.getEntry(
    590590            dict(student_id=self.student.student_id, p_id='p123'),
    591591            self.app) is self.student['payments']['p123']
    592         assert self.importer.getEntry(
     592        assert self.processor.getEntry(
    593593            dict(student_id=self.student.student_id, p_id='XXXXXX123'),
    594594            self.app) is self.student['payments']['p123']
     
    598598        payment1 = createObject(u'waeup.StudentOnlinePayment')
    599599        payment1.p_id = 'p234'
    600         self.importer.addEntry(
     600        self.processor.addEntry(
    601601            payment1, dict(student_id=self.student.student_id, p_id='p234'),
    602602            self.app)
     
    606606        payment1.p_id = 'nonsense'
    607607        # payment1.p_id will be replaced if p_id doesn't start with 'p'
    608         self.importer.addEntry(
     608        self.processor.addEntry(
    609609            payment2, dict(student_id=self.student.student_id, p_id='XXXXXX456'),
    610610            self.app)
     
    613613
    614614    def test_checkConversion(self):
    615         errs, inv_errs, conv_dict = self.importer.checkConversion(
     615        errs, inv_errs, conv_dict = self.processor.checkConversion(
    616616            dict(reg_number='1', p_id='3816951266236341955'))
    617617        self.assertEqual(len(errs),0)
    618         errs, inv_errs, conv_dict = self.importer.checkConversion(
     618        errs, inv_errs, conv_dict = self.processor.checkConversion(
    619619            dict(reg_number='1', p_id='p1266236341955'))
    620620        self.assertEqual(len(errs),0)
    621         errs, inv_errs, conv_dict = self.importer.checkConversion(
     621        errs, inv_errs, conv_dict = self.processor.checkConversion(
    622622            dict(reg_number='1', p_id='nonsense'))
    623623        self.assertEqual(len(errs),1)
    624624        timestamp = "%d" % int(time()*1000)
    625625        p_id = "p%s" % timestamp
    626         errs, inv_errs, conv_dict = self.importer.checkConversion(
     626        errs, inv_errs, conv_dict = self.processor.checkConversion(
    627627            dict(reg_number='1', p_id=p_id))
    628628        self.assertEqual(len(errs),0)
    629629
    630630    def test_import(self):
    631         num, num_warns, fin_file, fail_file = self.importer.doImport(
     631        num, num_warns, fin_file, fail_file = self.processor.doImport(
    632632            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
    633633        self.assertEqual(num_warns,0)
    634         payment = self.importer.getEntry(dict(reg_number='1',
     634        payment = self.processor.getEntry(dict(reg_number='1',
    635635            p_id='p1290797973744'), self.app)
    636636        self.assertEqual(payment.p_id, 'p1290797973744')
     
    642642    suite = unittest.TestSuite()
    643643    for testcase in [
    644         StudentImporterTest,StudentStudyCourseImporterTest,
    645         StudentStudyLevelImporterTest,CourseTicketImporterTest,
    646         PaymentImporterTest,]:
     644        StudentProcessorTest,StudentStudyCourseProcessorTest,
     645        StudentStudyLevelProcessorTest,CourseTicketProcessorTest,
     646        PaymentProcessorTest,]:
    647647        suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
    648648                testcase
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r7887 r7933  
    743743        importerselect = self.browser.getControl(name='importer')
    744744        modeselect = self.browser.getControl(name='mode')
    745         importerselect.getControl('Student Importer').selected = True
     745        importerselect.getControl('Student Processor').selected = True
    746746        modeselect.getControl(value='create').selected = True
    747747        self.browser.getControl('Proceed to step 3').click()
     
    770770        modeselect = self.browser.getControl(name='mode')
    771771        importerselect.getControl(
    772             'StudentStudyCourse Importer (update only)').selected = True
     772            'StudentStudyCourse Processor (update only)').selected = True
    773773        modeselect.getControl(value='create').selected = True
    774774        self.browser.getControl('Proceed to step 3').click()
  • main/waeup.kofa/trunk/src/waeup/kofa/university/batching.py

    r7811 r7933  
    3838    grok.provides(IBatchProcessor)
    3939    grok.context(Interface)
    40     util_name = 'facultyimporter'
    41     grok.name(util_name)
    42 
    43     name = u'Faculty Importer'
     40    util_name = 'facultyprocessor'
     41    grok.name(util_name)
     42
     43    name = u'Faculty Processor'
    4444    iface = IFaculty
    4545
     
    8080    grok.provides(IBatchProcessor)
    8181    grok.context(Interface)
    82     util_name = 'departmentimporter'
    83     grok.name(util_name)
    84 
    85     name = u'Department Importer'
     82    util_name = 'departmentprocessor'
     83    grok.name(util_name)
     84
     85    name = u'Department Processor'
    8686    iface = IDepartment
    8787
     
    127127    grok.provides(IBatchProcessor)
    128128    grok.context(Interface)
    129     util_name = 'courseimporter'
    130     grok.name(util_name)
    131 
    132     name = u'Course Importer'
     129    util_name = 'courseprocessor'
     130    grok.name(util_name)
     131
     132    name = u'Course Processor'
    133133    iface = ICourse
    134134
     
    178178    grok.provides(IBatchProcessor)
    179179    grok.context(Interface)
    180     util_name = 'certificateimporter'
    181     grok.name(util_name)
    182 
    183     name = u'Certificate Importer'
     180    util_name = 'certificateprocessor'
     181    grok.name(util_name)
     182
     183    name = u'Certificate Processor'
    184184    iface = ICertificate
    185185
     
    229229    grok.provides(IBatchProcessor)
    230230    grok.context(Interface)
    231     util_name = 'certificatecourseimporter'
    232     grok.name(util_name)
    233 
    234     name = u'CertificateCourse Importer'
     231    util_name = 'certificatecourseprocessor'
     232    grok.name(util_name)
     233
     234    name = u'CertificateCourse Processor'
    235235    iface = ICertificateCourse
    236236
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py

    r7907 r7933  
    4444
    4545    # Name used in pages and forms...
    46     name = u'Non-registered base importer'
     46    name = u'Non-registered base processor'
    4747
    4848    # Internal name...
    49     util_name = 'baseimporter'
     49    util_name = 'baseprocessor'
    5050
    5151    # Items for this processor need an interface with zope.schema fields.
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.txt

    r7811 r7933  
    1010mass-remove, or mass-update data.
    1111
    12 So you can feed CSV files to importers or processors, that are part of
     12So you can feed CSV files to processors, that are part of
    1313the batch-processing mechanism.
    1414
    15 Importers/Processors
    16 --------------------
     15Processors
     16----------
    1717
    1818Each CSV file processor
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py

    r7819 r7933  
    152152
    153153    In :mod:`waeup.kofa` we use factories extensively for
    154     batching. While processing a batch some importer looks up a
     154    batching. While processing a batch some processors looks up a
    155155    factory to create real-world instances that then get filled with
    156156    data from imported CSV files.
     
    192192       True
    193193
    194     After grokking we (and importers) can create objects without
     194    After grokking we (and processors) can create objects without
    195195    knowing about the location of the real class definition, just by
    196196    the factory name:
Note: See TracChangeset for help on using the changeset viewer.