Changeset 12873


Ignore:
Timestamp:
23 Apr 2015, 19:27:29 (10 years ago)
Author:
Henrik Bettermann
Message:

Convert level into a schema field to be consistent with the documentation.

Location:
main/waeup.kofa/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r12865 r12873  
    441.3.2.dev0 (unreleased)
    55=======================
     6
     7* Convert level into a schema field to be consistent with the documentation.
    68
    79* Rename classes StudentPaymentsExporter and BedTicketsExporter to be
  • main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py

    r12872 r12873  
    561561    factory_name = 'waeup.StudentStudyLevel'
    562562
    563     additional_fields = ['level']
    564     additional_fields_required = additional_fields
    565 
    566563    @property
    567564    def available_fields(self):
     
    581578        if studycourse is None:
    582579            return None
    583         return studycourse.get(row['level'])
     580        return studycourse.get(str(row['level']))
    584581
    585582    def delEntry(self, row, site):
     
    598595        items_changed = super(StudentStudyLevelProcessor, self).updateEntry(
    599596            obj, row, site, filename)
    600         obj.level = int(row['level'])
    601597        student = self.getParent(row, site).__parent__
    602598        student.__parent__.logger.info(
     
    607603    def addEntry(self, obj, row, site):
    608604        parent = self.getParent(row, site)
    609         obj.level = int(row['level'])
    610         parent[row['level']] = obj
    611         return
    612 
    613     def checkConversion(self, row, mode='ignore'):
    614         """Validates all values in row.
    615         """
    616         errs, inv_errs, conv_dict = super(
    617             StudentStudyLevelProcessor, self).checkConversion(row, mode=mode)
    618         try:
    619             level = int(row['level'])
    620             if level not in range(0,1000,10) + [999]:
    621                 errs.append(('level','no valid integer'))
    622         except ValueError:
    623             errs.append(('level','no integer'))
    624         return errs, inv_errs, conv_dict
     605        parent[str(row['level'])] = obj
     606        return
    625607
    626608class CourseTicketProcessor(StudentProcessorBase):
     
    653635        if student is None:
    654636            return None
    655         return student['studycourse'].get(row['level'])
     637        return student['studycourse'].get(str(row['level']))
    656638
    657639    def getEntry(self, row, site):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r12854 r12873  
    13211321    grok.name('index')
    13221322    grok.require('waeup.viewStudent')
    1323     form_fields = grok.AutoFields(IStudentStudyLevel)
     1323    form_fields = grok.AutoFields(IStudentStudyLevel).omit('level')
    13241324    form_fields[
    13251325        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     
    13531353    form_fields = grok.AutoFields(IStudentStudyLevel)
    13541354    form_fields[
    1355         'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le')
     1355        'validation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le').omit('level')
    13561356    prefix = 'form'
    13571357    omit_fields = (
     
    14341434    grok.template('studylevelmanagepage')
    14351435    form_fields = grok.AutoFields(IStudentStudyLevel).omit(
    1436         'validation_date', 'validated_by', 'total_credits', 'gpa')
     1436        'validation_date', 'validated_by', 'total_credits', 'gpa', 'level')
    14371437    pnav = 4
    14381438    taboneactions = [_('Save'),_('Cancel')]
     
    25972597    grok.require('waeup.editStudyLevel')
    25982598    grok.template('studyleveleditpage')
    2599     form_fields = grok.AutoFields(IStudentStudyLevel).omit(
    2600         'level_session', 'level_verdict')
    26012599    pnav = 4
    26022600    placeholder = _('Enter valid course code')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/export.py

    r12865 r12873  
    297297
    298298    fields = tuple(sorted(iface_names(
    299         IStudentStudyLevel) + ['level'])) + (
     299        IStudentStudyLevel))) + (
    300300        'student_id', 'number_of_tickets','certcode')
    301301    title = _(u'Student Study Levels')
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r12518 r12873  
    562562
    563563    """
    564     level = Attribute('The level code')
    565564    number_of_tickets = Attribute('Number of tickets contained in this level')
    566565    certcode = Attribute('The certificate code of the study course')
    567566    is_current_level = Attribute('Is this level the current level of the student?')
    568567    passed_params = Attribute('Information about passed and failed courses')
     568
     569    level = schema.Choice(
     570        title = _(u'Level'),
     571        source = StudyLevelSource(),
     572        required = True,
     573        readonly = False,
     574        )
    569575
    570576    level_session = schema.Choice(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/studylevel.py

    r10631 r12873  
    6767    def __init__(self):
    6868        super(StudentStudyLevel, self).__init__()
    69         self.level = None
    7069        return
    7170
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r12868 r12873  
    764764            dict(reg_number='1', level='1000'))
    765765        self.assertEqual(len(errs),1)
    766         self.assertTrue(('level','no valid integer') in errs)
     766        self.assertTrue(('level', u'Invalid value') in errs)
    767767        errs, inv_errs, conv_dict = self.processor.checkConversion(
    768768            dict(reg_number='1', level='xyz'))
    769769        self.assertEqual(len(errs),1)
    770         self.assertTrue(('level','no integer') in errs)
     770        self.assertTrue(('level', u'Invalid value') in errs)
    771771
    772772    def test_import(self):
Note: See TracChangeset for help on using the changeset viewer.