Ignore:
Timestamp:
18 Apr 2012, 05:12:32 (13 years ago)
Author:
Henrik Bettermann
Message:

Empty If no value is provided in import files, attributes must not be cleared. Clear attribute only if value == DELETIONMARKER.

File:
1 edited

Legend:

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

    r7950 r8202  
    3232from waeup.kofa.interfaces import (
    3333    IBatchProcessor, FatalCSVError, IObjectConverter,
    34     ICSVExporter)
     34    ICSVExporter, DELETIONMARKER)
    3535
    3636class BatchProcessor(grok.GlobalUtility):
     
    204204            # Skip fields not declared in interface.
    205205            if hasattr(obj, key):
    206                 setattr(obj, key, value)
     206                # Set attribute to None if value is marked for deletion
     207                if value == DELETIONMARKER:
     208                    setattr(obj, key, None)
     209                elif value is not None:
     210                    setattr(obj, key, value)
    207211        return
    208212
Note: See TracChangeset for help on using the changeset viewer.