Ignore:
Timestamp:
19 Apr 2012, 12:43:37 (13 years ago)
Author:
uli
Message:

Lots of trash to sketch filtered imports.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

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

    r8209 r8214  
    3434from waeup.kofa.interfaces import (
    3535    IBatchProcessor, FatalCSVError, IObjectConverter, IUserAccount,
    36     IObjectHistory, VALIDATED, DELETIONMARKER)
     36    IObjectHistory, VALIDATED, DELETION_MARKER, IGNORE_MARKER)
    3737from waeup.kofa.interfaces import MessageFactory as _
    3838from waeup.kofa.students.interfaces import (
     
    169169            elif hasattr(obj, key):
    170170                # Set attribute to None if value is marked for deletion
    171                 if value == DELETIONMARKER:
    172                     setattr(obj, key, None)
    173                 elif value is not None:
     171                #if value == DELETION_MARKER:
     172                #    setattr(obj, key, None)
     173                #elif value is not None:
     174                #    setattr(obj, key, value)
     175                #else:
     176                #    # No change, no change log
     177                #    continue
     178                if value != '<IGNORE>':
    174179                    setattr(obj, key, value)
    175                 else:
    176                     # No change, no change log
    177                     continue
    178             items_changed += '%s=%s, ' % (key,value)
     180               
     181                    items_changed += '%s=%s, ' % (key,value)
    179182        parent = self.getParent(row, site)
    180183        if hasattr(obj,'student_id'):
     
    215218        converter = IObjectConverter(iface)
    216219        errs, inv_errs, conv_dict =  converter.fromStringDict(
    217             row, self.factory_name)
     220            row, self.factory_name, mode=mode)
    218221        if row.has_key('reg_state') and \
    219222            not row['reg_state'] in IMPORTABLE_STATES:
     
    304307            if hasattr(obj, key):
    305308                # Set attribute to None if value is marked for deletion
    306                 if value == DELETIONMARKER:
    307                     setattr(obj, key, None)
    308                 elif value is not None:
    309                     setattr(obj, key, value)
    310                     if key == 'certificate':
    311                         value = value.code
    312             items_changed += '%s=%s, ' % (key,value)
     309                setattr(obj, key, value)
     310                if key == 'certificate':
     311                    value = value.code
     312
     313                #if value == DELETIONMARKER:
     314                #    setattr(obj, key, None)
     315                #elif value is not None:
     316                #    setattr(obj, key, value)
     317                #    if key == 'certificate':
     318                #        value = value.code
     319                items_changed += '%s=%s, ' % (key,value)
    313320        parent = self.getParent(row, site)
    314321        parent.__parent__.logger.info(
     
    698705            if hasattr(obj, key) and not key in [
    699706                'current_session','current_level']:
     707                setattr(obj, key, value)
    700708                # Set attribute to None if value is marked for deletion
    701                 if value == DELETIONMARKER:
    702                     setattr(obj, key, None)
    703                 elif value is not None:
    704                     setattr(obj, key, value)
    705             items_changed += '%s=%s, ' % (key,value)
     709                #if value == DELETIONMARKER:
     710                #    setattr(obj, key, None)
     711                #elif value is not None:
     712                #    setattr(obj, key, value)
     713                items_changed += '%s=%s, ' % (key,value)
    706714        parent = self.getParent(row, site)
    707715        parent.__parent__.logger.info(
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update2.csv

    r8210 r8214  
    11date_of_birth,matric_number,phone
    2 1970-01-02,100000,
     21970-01-02,100000,<IGNORE>
    331970-01-03,100001,XXX
    4 1970-01-04,100002,
     41970-01-04,100002,<IGNORE>
Note: See TracChangeset for help on using the changeset viewer.