Changeset 6824 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 28 Sep 2011, 17:08:05 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/batchprocessing.txt
r6823 r6824 95 95 ['Applicants Container Importer', 96 96 'Student Importer', 97 'StudentStudyCourse Importer', 97 98 'CertificateCourse Importer', 98 99 'Certificate Importer', … … 254 255 255 256 >>> importerselect = browser.getControl(name='importer') 256 >>> importerselect.getControl('Course Importer', index= 1).selected = True257 >>> importerselect.getControl('Course Importer', index=2).selected = True 257 258 >>> modeselect = browser.getControl(name='mode') 258 259 >>> modeselect.getControl(value='create').selected = True … … 484 485 >>> pending_file = dc_path + '/newfaculties_zope.mgr.create.pending.csv' 485 486 >>> print open(pending_file).read() 486 title_prefix, --IGNORE--,code,title,--ERRORS--487 title_prefix,code,title,--ERRORS-- 487 488 faculty,FAC1,Faculty 1,This object already exists in the same container. Skipping. 488 489 489 490 >>> finished_file = dc_path + '/finished/newfaculties_zope.mgr.create.finished.csv' 490 491 >>> print open(finished_file).read() 491 title_prefix, --IGNORE--,code,title492 title_prefix,code,title 492 493 school,FAC4,Faculty 4 493 494 -
main/waeup.sirp/trunk/src/waeup/sirp/utils/batching.py
r6276 r6824 102 102 def applyMapping(self, row, mapping): 103 103 """Apply mapping to a row of CSV data. 104 104 105 """ 105 106 result = dict() 106 107 for key, replacement in mapping.items(): 108 if replacement == u'--IGNORE--': 109 # Skip ignored columns in failed and finished data files. 110 continue 107 111 result[replacement] = row[key] 108 112 return result 109 113 110 114 def getMapping(self, path, headerfields, mode): 111 """Get a mapping from CSV file headerfields to actually used 112 fieldnames. 115 """Get a mapping from CSV file headerfields to actually used fieldnames. 116 113 117 """ 114 118 result = dict() … … 117 121 for num, field in enumerate(headerfields): 118 122 if field not in self.location_fields and mode == 'remove': 119 # Ignore non-location fields when removing... 120 field = '--IGNORE--' 123 # Skip non-location fields when removing. 124 continue 125 if field == u'--IGNORE--': 126 # Skip ignored columns in failed and finished data files. 127 continue 121 128 result[raw_header[num]] = field 122 129 return result … … 250 257 conv_warnings = self.stringFromErrs(errs, inv_errs) 251 258 self.writeFailedRow( 252 failed_writer, raw_row, conv_warnings)259 failed_writer, string_row, conv_warnings) 253 260 continue 254 261 row.update(conv_dict) … … 258 265 num_warns += 1 259 266 self.writeFailedRow( 260 failed_writer, raw_row,267 failed_writer, string_row, 261 268 "Not all parents do exist yet. Skipping") 262 269 continue … … 264 271 num_warns += 1 265 272 self.writeFailedRow( 266 failed_writer, raw_row,273 failed_writer, string_row, 267 274 "This object already exists in the same container. Skipping.") 268 275 continue … … 275 282 num_warns += 1 276 283 self.writeFailedRow( 277 failed_writer, raw_row,284 failed_writer, string_row, 278 285 "%s Skipping." % error.message) 279 286 continue … … 282 289 num_warns += 1 283 290 self.writeFailedRow( 284 failed_writer, raw_row,291 failed_writer, string_row, 285 292 "Cannot remove: no such entry.") 286 293 continue … … 291 298 num_warns += 1 292 299 self.writeFailedRow( 293 failed_writer, raw_row,300 failed_writer, string_row, 294 301 "Cannot update: no such entry.") 295 302 continue -
main/waeup.sirp/trunk/src/waeup/sirp/utils/batching.txt
r6741 r6824 352 352 353 353 If something goes wrong during processing, the respective --IGNORE-- 354 cols w ill be populated correctlyin the resulting pending file:354 cols won't be populated in the resulting pending file: 355 355 356 356 >>> result = processor.doImport('newcomers.csv', ['name', 'dinoports', … … 361 361 362 362 >>> print open(result[3], 'rb').read() 363 --IGNORE--,name,--IGNORE--,dinoports,--ERRORS-- 364 Barney,Barneys Home,1,2,This object already exists in the same container. Skipping. 365 Wilma,Wilmas Asylum,1,1,This object already exists in the same container. Skipping. 366 Fred,Freds Dinoburgers,0,10,This object already exists in the same container. Skipping. 367 Joey,Joeys Drive-in,0,110,This object already exists in the same container. Skipping. 368 369 The first ignored column ('owner') provides different contents than 370 the second one ('taxpayer'). 363 name,dinoports,--ERRORS-- 364 Barneys Home,2,This object already exists in the same container. Skipping. 365 Wilmas Asylum,1,This object already exists in the same container. Skipping. 366 Freds Dinoburgers,10,This object already exists in the same container. Skipping. 367 Joeys Drive-in,110,This object already exists in the same container. Skipping. 368 371 369 372 370 Clean up:
Note: See TracChangeset for help on using the changeset viewer.