Ignore:
Timestamp:
30 Sep 2011, 10:27:23 (13 years ago)
Author:
Henrik Bettermann
Message:

Ensure that only update mode can be used for StudentStudyCourse? imports. Import mode is automatically set to 'update' if the processor's util_name contains 'update'. We can use the same technique for other processors and modes (to be implemented).

Location:
main/waeup.sirp/trunk/src/waeup/sirp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/batchprocessing.txt

    r6824 r6837  
    9595    ['Applicants Container Importer',
    9696     'Student Importer',
    97      'StudentStudyCourse Importer',
     97     'StudentStudyCourse Importer (update only)',
    9898     'CertificateCourse Importer',
    9999     'Certificate Importer',
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py

    r6828 r6837  
    612612            self.mode_locked = True
    613613        self.importer = importer or session.get('import_importer', None)
     614        session['import_importer'] = self.importer
     615        if self.importer and 'update' in self.importer:
     616            if self.mode != 'update':
     617                self.flash('Update mode only!')
     618                self.mode_locked = True
     619                self.mode = 'update'
     620                proceed = None
    614621        session['import_mode'] = self.mode
    615         session['import_importer'] = self.importer
    616622        if proceed is not None:
    617623            self.redirect(self.url(self.context, '@@import3'))
  • main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py

    r6834 r6837  
    3131    location_fields = ['student_id',]
    3232    factory_name = 'waeup.Student'
    33 
    34     mode = None
    3533
    3634    @property
     
    7775    grok.provides(IBatchProcessor)
    7876    grok.context(Interface)
    79     util_name = 'studycourseimporter'
     77    util_name = 'studycourseupdater'
    8078    grok.name(util_name)
    8179
    82     name = u'StudentStudyCourse Importer'
     80    name = u'StudentStudyCourse Importer (update only)'
    8381    iface = IStudentStudyCourseImport
    8482    factory_name = 'waeup.StudentStudyCourse'
     
    9088            ['student_id','reg_number'] + getFields(self.iface).keys())))
    9189
    92     def checkHeaders(self, headerfields, mode='update'):
     90    def checkHeaders(self, headerfields, mode='ignore'):
    9391        if not 'reg_number' in headerfields and not 'student_id' in headerfields:
    9492            raise FatalCSVError(
Note: See TracChangeset for help on using the changeset viewer.