Ignore:
Timestamp:
22 May 2015, 07:17:29 (10 years ago)
Author:
Henrik Bettermann
Message:

Remove quite old bug in doImport: Replace empty strings *and* lists with
ignore-markers in update *and* create mode.

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

Legend:

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

    r12971 r12981  
    441.3.2.dev0 (unreleased)
    55=======================
     6
     7* Remove quite old bug in `doImport`: Replace empty strings *and* lists with
     8  ignore-markers in update *and* create mode.
    69
    710* Add StudentUnpaidPaymentExporter to export only unpaid tickets.
  • main/waeup.kofa/trunk/src/waeup/kofa/doctests/batchprocessing_browser.txt

    r12946 r12981  
    642642    >>> print open(pending_file).read()
    643643    name,roles,title,public_name,phone,email,--ERRORS--
    644     anne,['waeup.Nonsense'],Anne Palina,,+49-234-567,anne@abc.de,roles: invalid role
     644    anne,['waeup.Nonsense'],Anne Palina,<IGNORE>,+49-234-567,anne@abc.de,roles: invalid role
    645645
    646646There are many finished-files:
  • main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py

    r12894 r12981  
    514514            "beds_for_pre=['G'], floors_per_block=1, "
    515515            "beds_for_final=['A', 'B'], rooms_per_floor=32, "
    516             "blocks_for_male=[], hostel_id=block-a-upper-hostel, "
     516            "hostel_id=block-a-upper-hostel, "
    517517            "sort_id=20, beds_for_returning=['C', 'D'], "
    518518            "hostel_name=Block A Upper Hostel, beds_for_fresh=['E', 'F'], "
    519             "blocks_for_female=['A'], beds_for_all=[], beds_reserved=[]"
     519            "blocks_for_female=['A']"
    520520            in logcontent)
    521521        shutil.rmtree(os.path.dirname(fin_file))
     
    542542            "beds_for_pre=['G'], floors_per_block=1, "
    543543            "beds_for_final=['A', 'B'], rooms_per_floor=32, "
    544             "blocks_for_male=[], hostel_id=block-a-upper-hostel, "
     544            "hostel_id=block-a-upper-hostel, "
    545545            "sort_id=20, beds_for_returning=['C', 'D'], "
    546546            "hostel_name=Block A Upper Hostel, beds_for_fresh=['E', 'F'], "
    547             "blocks_for_female=['A'], beds_for_all=[], beds_reserved=[]"
     547            "blocks_for_female=['A']"
    548548            in logcontent)
    549549        shutil.rmtree(os.path.dirname(fin_file))
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r12873 r12981  
    513513            'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,--ERRORS--\r\n'
    514514            '4,John,D123456,m,aa@aa.ng,1234,nonsense,1990-01-05,Wolter,mypw1,100003,state: not allowed\r\n'
    515             '5,John,E123456,x,aa@aa.ng,1234,,1990-01-06,Kennedy,,100004,sex: Invalid value\r\n'
     515            '5,John,E123456,x,aa@aa.ng,1234,<IGNORE>,1990-01-06,Kennedy,<IGNORE>,100004,sex: Invalid value\r\n'
    516516            )
    517517        students = self.app['students']
     
    547547            '1,Aaren,B123456,m,aa@aa.ng,1234,cleared,1990-01-03,Finau,mypw1,100001,reg_number: Invalid input\r\n'
    548548            '2,Aaren,C123456,m,aa@aa.ng,1234,admitted,1990-01-04,Berson,mypw1,100000,matric_number: Invalid input\r\n'
    549             '1,Frank,F123456,m,aa@aa.ng,1234,,1990-01-06,Meyer,,100000,reg_number: Invalid input; matric_number: Invalid input\r\n'
    550             '3,Uli,A123456,m,aa@aa.ng,1234,,1990-01-07,Schulz,,100002,This object already exists.\r\n'
     549            '1,Frank,F123456,m,aa@aa.ng,1234,<IGNORE>,1990-01-06,Meyer,<IGNORE>,100000,reg_number: Invalid input; matric_number: Invalid input\r\n'
     550            '3,Uli,A123456,m,aa@aa.ng,1234,<IGNORE>,1990-01-07,Schulz,<IGNORE>,100002,This object already exists.\r\n'
    551551            )
    552552        shutil.rmtree(os.path.dirname(fin_file))
     
    780780        self.assertEqual(studylevel.__parent__.certificate.code, u'CERT1')
    781781        self.assertEqual(studylevel.level_session, 2008)
    782         self.assertEqual(studylevel.level_verdict, None)
     782        self.assertEqual(studylevel.level_verdict, '0')
    783783        self.assertEqual(studylevel.level, 100)
    784784        shutil.rmtree(os.path.dirname(fin_file))
     
    891891        self.assertEqual(fail_file,
    892892            'reg_number,code,mandatory,level,level_session,score,matric_number,--ERRORS--\r\n'
    893             '1,COURSE1,,nonsense,,5,,Not all parents do exist yet.\r\n'
    894             '1,NONSENSE,,100,,5,,code: non-existent\r\n'
    895             '1,COURSE1,,200,2004,6,,level_session: does not match 2008\r\n'
    896             '1,COURSE1,,300,2008,6,,level: does not exist\r\n'
    897             '1,COURSE1,,300,2008X,6,,level_session: Invalid value\r\n')
     893            '1,COURSE1,<IGNORE>,nonsense,<IGNORE>,5,<IGNORE>,Not all parents do exist yet.\r\n'
     894            '1,NONSENSE,<IGNORE>,100,<IGNORE>,5,<IGNORE>,code: non-existent\r\n'
     895            '1,COURSE1,<IGNORE>,200,2004,6,<IGNORE>,level_session: does not match 2008\r\n'
     896            '1,COURSE1,<IGNORE>,300,2008,6,<IGNORE>,level: does not exist\r\n'
     897            '1,COURSE1,<IGNORE>,300,2008X,6,<IGNORE>,level_session: Invalid value\r\n')
    898898        assert self.processor.entryExists(
    899899            dict(reg_number='1', level='100', code='COURSE1'),
     
    12201220        studycourse = self.processor.getEntry(dict(matric_number='100000'),
    12211221                                              self.app)
    1222         self.assertEqual(studycourse['200'].level_verdict, None)
     1222        self.assertEqual(studycourse['200'].level_verdict, '0')
    12231223        student = self.processor.getParent(
    12241224            dict(matric_number='100000'), self.app)
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py

    r12869 r12981  
    384384                continue
    385385            string_row = self.applyMapping(raw_row, mapping)
    386             if ignore_empty and mode in ('update',):
    387                 # Replace empty strings with ignore-markers
     386            if ignore_empty:
     387                # Replace empty strings and empty lists with ignore-markers
    388388                for key, val in string_row.items():
    389                     if val == '':
     389                    if val == '' or val == '[]':
    390390                        string_row[key] = IGNORE_MARKER
    391391            row = dict(string_row.items()) # create deep copy
Note: See TracChangeset for help on using the changeset viewer.