- Timestamp:
- 21 Feb 2022, 09:39:05 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r16079 r16819 27 27 import unicodecsv as csv # XXX: csv ops should move to dedicated module. 28 28 from time import time 29 from ast import literal_eval 29 30 from datetime import datetime 30 31 from zope.i18n import translate … … 92 93 return sorted(list(set( 93 94 ['student_id','reg_number','matric_number', 94 'password', 'state', 'transition' ] + fields.keys())))95 'password', 'state', 'transition', 'history'] + fields.keys()))) 95 96 96 97 def checkHeaders(self, headerfields, mode='create'): … … 227 228 row.pop('password') 228 229 230 # Replace entire history 231 if 'history' in row: 232 new_history = row.get('history', IGNORE_MARKER) 233 if new_history not in (IGNORE_MARKER, ''): 234 history = IObjectHistory(obj) 235 history._annotations[ 236 history.history_key] = literal_eval(new_history) 237 items_changed += ('%s=%s, ' % ('history', new_history)) 238 row.pop('history') 239 229 240 # Update registration state 230 241 if 'state' in row: … … 233 244 value = row['state'] 234 245 IWorkflowState(obj).setState(value) 235 msg = _("State '${a}' set", mapping = {'a':value})246 msg = _("State '${a}' imported", mapping = {'a':value}) 236 247 history = IObjectHistory(obj) 237 248 history.addMessage(msg) … … 302 313 row['state'] not in (IGNORE_MARKER, ''): 303 314 errs.append(('workflow','not allowed')) 304 return errs, inv_errs, conv_dict305 315 if 'transition' in row: 306 316 if row['transition'] not in IMPORTABLE_TRANSITIONS: … … 315 325 # be changed if empty. 316 326 conv_dict['state'] = IGNORE_MARKER 327 if 'history' in row: 328 if row['history'] not in (IGNORE_MARKER, ''): 329 try: 330 new_history = literal_eval(row['history']) 331 except: 332 errs.append(('history','malformed string')) 317 333 try: 318 334 # Correct stud_id counter. As the IConverter for students
Note: See TracChangeset for help on using the changeset viewer.