Changeset 8214 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 19 Apr 2012, 12:43:37 (13 years ago)
- 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 34 34 from waeup.kofa.interfaces import ( 35 35 IBatchProcessor, FatalCSVError, IObjectConverter, IUserAccount, 36 IObjectHistory, VALIDATED, DELETION MARKER)36 IObjectHistory, VALIDATED, DELETION_MARKER, IGNORE_MARKER) 37 37 from waeup.kofa.interfaces import MessageFactory as _ 38 38 from waeup.kofa.students.interfaces import ( … … 169 169 elif hasattr(obj, key): 170 170 # 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>': 174 179 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) 179 182 parent = self.getParent(row, site) 180 183 if hasattr(obj,'student_id'): … … 215 218 converter = IObjectConverter(iface) 216 219 errs, inv_errs, conv_dict = converter.fromStringDict( 217 row, self.factory_name )220 row, self.factory_name, mode=mode) 218 221 if row.has_key('reg_state') and \ 219 222 not row['reg_state'] in IMPORTABLE_STATES: … … 304 307 if hasattr(obj, key): 305 308 # 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) 313 320 parent = self.getParent(row, site) 314 321 parent.__parent__.logger.info( … … 698 705 if hasattr(obj, key) and not key in [ 699 706 'current_session','current_level']: 707 setattr(obj, key, value) 700 708 # 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) 706 714 parent = self.getParent(row, site) 707 715 parent.__parent__.logger.info( -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update2.csv
r8210 r8214 1 1 date_of_birth,matric_number,phone 2 1970-01-02,100000, 2 1970-01-02,100000,<IGNORE> 3 3 1970-01-03,100001,XXX 4 1970-01-04,100002, 4 1970-01-04,100002,<IGNORE>
Note: See TracChangeset for help on using the changeset viewer.