Changeset 9846


Ignore:
Timestamp:
9 Jan 2013, 06:23:49 (12 years ago)
Author:
Henrik Bettermann
Message:

Transform level and session values into integers.

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

Legend:

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

    r9845 r9846  
    124124            if idx_name == 'catalog':
    125125                continue
     126            if isinstance(value, str) and ('session' in idx_name
     127                or 'level' in idx_name):
     128                value = int(value)
    126129            if not isinstance(value, tuple):
    127130                value = (value, value)
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py

    r9845 r9846  
    202202            current_session=2012, current_level=None)
    203203        result2 = open(self.outfile, 'rb').read()
     204        # current_level can be both a string ...
    204205        exporter.export_filtered(
    205206            self.app, self.outfile,
    206             current_session=None, current_level=200)
     207            current_session=None, current_level='200')
    207208        result3 = open(self.outfile, 'rb').read()
    208209        exporter.export_filtered(
     
    210211            current_session=2011, current_level=None)
    211212        result4 = open(self.outfile, 'rb').read()
     213        # ... and an integer
    212214        exporter.export_filtered(
    213215            self.app, self.outfile,
     
    227229        notify(grok.ObjectModifiedEvent(self.student))
    228230        exporter = StudentsExporter()
    229 
     231        # current_session can be both a string ...
    230232        exporter.export_filtered(
    231233            self.app, self.outfile,
    232             current_session=2012, current_level=200, depcode='NA')
     234            current_session='2012', current_level='200', depcode='NA')
    233235        result1 = open(self.outfile, 'rb').read()
     236        # ... and an integer
    234237        exporter.export_filtered(
    235238            self.app, self.outfile,
     
    249252        exporter.export_filtered(
    250253            self.app, self.outfile,
    251             current_session=2012, current_level=200, faccode='NA')
     254            current_session=2012, current_level='200', faccode='NA')
    252255        result1 = open(self.outfile, 'rb').read()
    253256        exporter.export_filtered(
Note: See TracChangeset for help on using the changeset viewer.