Changeset 7656 for main/waeup.sirp
- Timestamp:
- 16 Feb 2012, 08:35:53 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/batching.py
r7652 r7656 134 134 parent = self.getParent(row, site) 135 135 parent.addStudent(obj) 136 # In some tests we don't have a students container 137 try: 138 parent.logger.info('%s - Student record imported' % ( 139 obj.student_id)) 140 history = IObjectHistory(obj) 141 history.addMessage('Student record imported') 142 except (TypeError, AttributeError): 143 pass 136 # We don't need to log this because is already done by the workflow 137 # transition even handler. 138 history = IObjectHistory(obj) 139 history.addMessage('Student record imported') 144 140 return 145 141 … … 148 144 if student is not None: 149 145 parent = self.getParent(row, site) 146 parent.logger.info('%s - Student removed' % student.student_id) 150 147 del parent[student.student_id] 151 148 pass … … 157 154 if row.has_key('student_id') and row['student_id'] is None: 158 155 row.pop('student_id') 156 items_changed = '' 159 157 for key, value in row.items(): 160 158 # Set student password and all fields declared in interface. … … 168 166 elif hasattr(obj, key): 169 167 setattr(obj, key, value) 168 items_changed += '%s=%s, ' % (key,value) 169 parent = self.getParent(row, site) 170 if hasattr(obj,'student_id'): 171 # Update mode: the student exists and we can get the student_id 172 parent.logger.info( 173 '%s - Student record updated: %s' 174 % (obj.student_id, items_changed)) 175 else: 176 # Create mode: the student does not yet exist 177 parent.logger.info('Student data imported: %s' % items_changed) 170 178 return 171 179 … … 281 289 """Update obj to the values given in row. 282 290 """ 291 items_changed = '' 283 292 for key, value in row.items(): 284 293 # Skip fields not declared in interface. 285 294 if hasattr(obj, key): 286 295 setattr(obj, key, value) 296 if key == 'certificate': 297 value = value.code 298 items_changed += '%s=%s, ' % (key,value) 299 parent = self.getParent(row, site) 300 parent.__parent__.logger.info( 301 '%s - Study course updated: %s' 302 % (parent.student_id, items_changed)) 287 303 # Update the students_catalog 288 304 notify(grok.ObjectModifiedEvent(obj.__parent__))
Note: See TracChangeset for help on using the changeset viewer.