Ignore:
Timestamp:
14 Feb 2012, 09:32:28 (13 years ago)
Author:
Henrik Bettermann
Message:

Enable mixed imports of rows with or without student_id.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py

    r7626 r7643  
    156156        """Update obj to the values given in row.
    157157        """
     158        # Remove student_id from row if empty
     159        if row.has_key('student_id') and row['student_id'] is None:
     160            row.pop('student_id')
    158161        for key, value in row.items():
    159162            # Set student password and all fields declared in interface.
     
    188191        """Validates all values in row.
    189192        """
     193        iface = self.iface
    190194        if mode in ['update', 'remove']:
    191195            if self.getLocator(row) == 'reg_number':
     
    193197            elif self.getLocator(row) == 'matric_number':
    194198                iface = IStudentUpdateByMatricNo
    195         else:
    196             iface = self.iface
    197199        converter = IObjectConverter(iface)
    198200        errs, inv_errs, conv_dict =  converter.fromStringDict(
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/sample_student_data.csv

    r7522 r7643  
    1 firstname,lastname,reg_number,date_of_birth,matric_number,email,phone
    2 Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234
    3 Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234
    4 Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234
     1student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone
     2X666666,Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234
     3,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234
     4,Aaren,Berson,3,1990-01-04,100002,aa@aa.ng,1234
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_batching.py

    r7623 r7643  
    201201        self.assertEqual(num_warns,0)
    202202        assert len(self.app['students'].keys()) == 4
     203        self.assertEqual(self.app['students']['X666666'].reg_number,'1')
    203204        shutil.rmtree(os.path.dirname(fin_file))
    204205
Note: See TracChangeset for help on using the changeset viewer.