Changeset 4870 for waeup/trunk/src


Ignore:
Timestamp:
21 Jan 2010, 14:56:35 (15 years ago)
Author:
uli
Message:

Make sure that only unconverted rows are written to pending files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/utils/batching.py

    r4858 r4870  
    55"""
    66import grok
     7import copy
    78import csv
    89import os
     
    232233            num += 1
    233234            string_row = self.applyMapping(raw_row, mapping)
    234             row, conv_warnings = self.convertToTypes(string_row, converters)
     235            row, conv_warnings = self.convertToTypes(
     236                copy.deepcopy(string_row), converters)
    235237            if len(conv_warnings):
    236238                warnings[num] = ', '.join(conv_warnings)
    237                 failed_writer.writerow(row)
     239                failed_writer.writerow(string_row)
    238240                continue
    239241               
     
    241243                if not self.parentsExist(row, site):
    242244                    warnings[num] = "Not all parents do exist yet. Skipping"
    243                     failed_writer.writerow(row)
     245                    failed_writer.writerow(string_row)
    244246                    continue
    245247                if self.entryExists(row, site):
    246248                    warnings[num] = 'This object already exists. Skipping.'
    247                     failed_writer.writerow(row)
     249                    failed_writer.writerow(string_row)
    248250                    continue
    249251                obj = self.callFactory()
     
    254256                if not self.entryExists(row, site):
    255257                    warnings[num] = "Cannot remove: no such entry."
    256                     failed_writer.writerow(row)
     258                    failed_writer.writerow(string_row)
    257259                    continue
    258260                self.delEntry(row, site)
     
    261263                if obj is None:
    262264                    warnings[num] = "Cannot update: no such entry."
    263                     failed_writer.writerow(row)
     265                    failed_writer.writerow(string_row)
    264266                    continue
    265267                self.updateEntry(obj, row, site)
Note: See TracChangeset for help on using the changeset viewer.