Changeset 8885 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 3 Jul 2012, 09:47:27 (12 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
r8884 r8885 363 363 return errs, inv_errs, conv_dict 364 364 365 def getMapping(self, path, headerfields, mode): 366 """Get a mapping from CSV file headerfields to actually used fieldnames. 367 """ 368 result = dict() 369 reader = csv.reader(open(path, 'rb')) 370 raw_header = reader.next() 371 for num, field in enumerate(headerfields): 372 if field not in ['student_id', 'reg_number', 'matric_number', 'p_id' 373 ] and mode == 'remove': 374 continue 375 if field == u'--IGNORE--': 376 # Skip ignored columns in failed and finished data files. 377 continue 378 result[raw_header[num]] = field 379 return result 380 365 381 366 382 class StudentStudyCourseProcessor(StudentProcessorBase): … … 564 580 def checkHeaders(self, headerfields, mode='ignore'): 565 581 super(StudentOnlinePaymentProcessor, self).checkHeaders(headerfields) 566 if mode == 'update'and not 'p_id' in headerfields:582 if mode in ('update', 'remove') and not 'p_id' in headerfields: 567 583 raise FatalCSVError( 568 "Need p_id for import in update mode!")584 "Need p_id for import in update and remove modes!") 569 585 return True 570 586 … … 602 618 student = self.getParent(row, site).__parent__ 603 619 student.__parent__.logger.info( 604 '%s - Payment ticketupdated: %s'605 % (student.student_id, items_changed))620 '%s - %s - updated: %s' 621 % (student.student_id, obj.p_id, items_changed)) 606 622 return 607 623 … … 616 632 parent[p_id] = obj 617 633 return 634 635 def delEntry(self, row, site): 636 payment = self.getEntry(row, site) 637 parent = self.getParent(row, site) 638 if payment is not None: 639 student = self._getStudent(row, site) 640 student.__parent__.logger.info('%s - removed: %s' 641 % (student.student_id, payment.p_id)) 642 del parent[payment.p_id] 643 pass 618 644 619 645 def checkConversion(self, row, mode='ignore'): -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8858 r8885 1030 1030 mapping = {'a': ', '.join(deleted)})) 1031 1031 self.context.writeLogMessage( 1032 self,'removed: % 1032 self,'removed: %s' % ', '.join(deleted)) 1033 1033 self.redirect(self.url(self.context)) 1034 1034 return
Note: See TracChangeset for help on using the changeset viewer.