Changeset 12868 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 21 Apr 2015, 20:56:58 (10 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt
r12439 r12868 574 574 >>> print open(pending_file).read() 575 575 title_prefix,code,title,--ERRORS-- 576 faculty,FAC1,Faculty 1,This object already exists. Skipping.576 faculty,FAC1,Faculty 1,This object already exists. 577 577 faculty,FAC 5,Faculty 5,code: Invalid input 578 578 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r12811 r12868 548 548 '2,Aaren,C123456,m,aa@aa.ng,1234,admitted,1990-01-04,Berson,mypw1,100000,matric_number: Invalid input\r\n' 549 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. Skipping.\r\n'550 '3,Uli,A123456,m,aa@aa.ng,1234,,1990-01-07,Schulz,,100002,This object already exists.\r\n' 551 551 ) 552 552 shutil.rmtree(os.path.dirname(fin_file)) … … 891 891 self.assertEqual(fail_file, 892 892 'reg_number,code,mandatory,level,level_session,score,matric_number,--ERRORS--\r\n' 893 '1,COURSE1,,nonsense,,5,,Not all parents do exist yet. Skipping\r\n'893 '1,COURSE1,,nonsense,,5,,Not all parents do exist yet.\r\n' 894 894 '1,NONSENSE,,100,,5,,code: non-existent\r\n' 895 895 '1,COURSE1,,200,2004,6,,level_session: does not match 2008\r\n' … … 1176 1176 '1,942,online,BTECHBDT,2010/11/26 19:59:33.744 GMT+1,0,' 1177 1177 '19500,schoolfee,19500,2015,paid,' 1178 'Same payment has already been made. Skipping.'1178 'Same payment has already been made.' 1179 1179 in content) 1180 1180 shutil.rmtree(os.path.dirname(fin_file)) -
main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py
r11790 r12868 448 448 'local_roles: user_name or local_role missing\r\n' 449 449 'FAC11,DEP2,"[{\'user_name\':\'anne\',\'local_role\':\'waeup.local.DepartmentManager\'}]",' 450 'Not all parents do exist yet. Skipping\r\n'450 'Not all parents do exist yet.\r\n' 451 451 ) 452 452 # Anne got a local role in department DEP2. … … 537 537 'local_roles: user_name or local_role missing\r\n' 538 538 'FAC11,DEP2,CRS2,"[{\'user_name\':\'anne\',\'local_role\':\'waeup.local.Lecturer\'}]",' 539 'Not all parents do exist yet. Skipping\r\n'539 'Not all parents do exist yet.\r\n' 540 540 ) 541 541 # Anne got a local role in course CRS2. … … 636 636 'local_roles: user_name or local_role missing\r\n' 637 637 'FAC11,DEP2,CRT2,"[{\'user_name\':\'anne\',\'local_role\':\'waeup.local.CourseAdviser100\'}]",' 638 'Not all parents do exist yet. Skipping\r\n'638 'Not all parents do exist yet.\r\n' 639 639 ) 640 640 # Anne got a local role in certificate CRT2. … … 726 726 'faculty_code,course,level,department_code,certificate_code,' 727 727 '--ERRORS--\r\nFAC1,CRS1,100,DEP1,CRT1,' 728 'This object already exists. Skipping.\r\nFAC1,CRS1,100,DEP1,CRT2,'729 'Not all parents do exist yet. Skipping\r\n'728 'This object already exists.\r\nFAC1,CRS1,100,DEP1,CRT2,' 729 'Not all parents do exist yet.\r\n' 730 730 731 731 ) -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.py
r12867 r12868 298 298 1. An empty row is skipped. 299 299 300 2. Empty strings are replaced by ignore-markers. 301 302 3. The `BatchProcessor.checkConversion` method validates all 303 values in the row. If the validation fails 304 305 4. 306 307 5. 308 309 6. 300 2. Empty strings in the row are replaced by ignore-markers. 301 302 3. The `BatchProcessor.checkConversion` method validates and converts 303 all values in the row. Conversion means the transformation of strings 304 into Python objects. For instance, number expressions have to be 305 transformed into integers, dates into datetime objects, phone number 306 expressions into phone number objects, etc. The converter returns a 307 dictionary with converted values or, if the validation of one of the 308 elements fails, an appropriate warning message. If the conversion 309 fails a pending record is created and stored in the pending data file 310 together with a warning message the converter has raised. 311 312 4. In **create mode** only: 313 314 The parent object must be found and a child 315 object with same object id must not exist. Otherwise the row 316 is skipped, a corresponding warning message is raised and a 317 record is stored in the pending data file. 318 319 Now ``doImport`` tries to add the new object with the data 320 from the conversion dictionary. In some cases this 321 may fail and a DuplicationError is raised. For example, a new 322 payment ticket is created but the same payment for same session 323 has already been made. In this case the object id is unique, no 324 other object with same id exists, but making the 'same' payment 325 twice does not make sense. The import is skipped and a 326 record is stored in the pending data file. 327 328 5. In **update mode** only: 329 330 If the object can't be found, the row is skipped, 331 a ``no such entry`` warning message is raised and a record is 332 stored in the pending data file. 333 334 The `BatchProcessor.checkUpdateRequirements` method checks additional 335 requirements the object must fulfill before being updated. These 336 requirements are not imposed by the data type but the context 337 of the object. For example, post-graduate students have a different 338 registration workflow. With this method we do forbid certain workflow 339 transitions or states. 340 341 Finally, ``doImport`` updates the existing object with the data 342 from the conversion dictionary. 343 344 6. In **remove mode** only: 345 346 If the object can't be found, the row is skipped, 347 a ``no such entry`` warning message is raised and a record is 348 stored in the pending data file. 349 350 Finally, ``doImport`` removes the existing object. 310 351 311 352 """ … … 364 405 self.writeFailedRow( 365 406 failed_writer, string_row, 366 "Not all parents do exist yet. Skipping")407 "Not all parents do exist yet.") 367 408 continue 368 409 if self.entryExists(row, site): … … 370 411 self.writeFailedRow( 371 412 failed_writer, string_row, 372 "This object already exists. Skipping.")413 "This object already exists.") 373 414 continue 374 415 obj = self.callFactory() … … 382 423 num_warns += 1 383 424 self.writeFailedRow( 384 failed_writer, string_row, 385 "%s Skipping." % error.message) 425 failed_writer, string_row, error.message) 386 426 continue 387 427 except DuplicationError, error: 388 428 num_warns += 1 389 429 self.writeFailedRow( 390 failed_writer, string_row, 391 "%s Skipping." % error.msg) 430 failed_writer, string_row, error.msg) 392 431 continue 393 432 elif mode == 'remove': -
main/waeup.kofa/trunk/src/waeup/kofa/utils/batching.txt
r9739 r12868 309 309 >>> print open(result[3]).read() 310 310 owner,name,taxpayer,dinoports,--ERRORS-- 311 Barney,Barneys Home,1,2,This object already exists. Skipping.312 Wilma,Wilmas Asylum,1,1,This object already exists. Skipping.313 Fred,Freds Dinoburgers,0,10,This object already exists. Skipping.314 Joey,Joeys Drive-in,0,110,This object already exists. Skipping.311 Barney,Barneys Home,1,2,This object already exists. 312 Wilma,Wilmas Asylum,1,1,This object already exists. 313 Fred,Freds Dinoburgers,0,10,This object already exists. 314 Joey,Joeys Drive-in,0,110,This object already exists. 315 315 316 316 This way we can correct the faulty entries and afterwards retry without … … 350 350 >>> print open(result[3], 'rb').read() 351 351 name,dinoports,--ERRORS-- 352 Barneys Home,2,This object already exists. Skipping.353 Wilmas Asylum,1,This object already exists. Skipping.354 Freds Dinoburgers,10,This object already exists. Skipping.355 Joeys Drive-in,110,This object already exists. Skipping.352 Barneys Home,2,This object already exists. 353 Wilmas Asylum,1,This object already exists. 354 Freds Dinoburgers,10,This object already exists. 355 Joeys Drive-in,110,This object already exists. 356 356 357 357
Note: See TracChangeset for help on using the changeset viewer.