Changeset 8287 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 26 Apr 2012, 14:13:51 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/batching.py
r8284 r8287 64 64 return sorted(list(set( 65 65 ['student_id','reg_number','matric_number', 66 'password', ' reg_state'] + getFields(66 'password', 'state'] + getFields( 67 67 self.iface).keys()))) 68 68 … … 133 133 parent = self.getParent(row, site) 134 134 parent.addStudent(obj) 135 # We have to log this if reg_state is provided. If not,135 # We have to log this if state is provided. If not, 136 136 # logging is done by the event handler handle_student_added 137 if row.has_key(' reg_state'):137 if row.has_key('state'): 138 138 parent.logger.info('%s - Student record created' % obj.student_id) 139 139 history = IObjectHistory(obj) … … 166 166 167 167 # Update registration state 168 reg_state = row.get('reg_state', IGNORE_MARKER)169 if reg_state not in (IGNORE_MARKER, ''):170 value = row[' reg_state']168 state = row.get('state', IGNORE_MARKER) 169 if state not in (IGNORE_MARKER, ''): 170 value = row['state'] 171 171 IWorkflowState(obj).setState(value) 172 172 msg = _("State '${a}' set", mapping = {'a':value}) 173 173 history = IObjectHistory(obj) 174 174 history.addMessage(msg) 175 row.pop(' reg_state')175 row.pop('state') 176 176 177 177 # apply other values... … … 219 219 errs, inv_errs, conv_dict = converter.fromStringDict( 220 220 row, self.factory_name, mode=mode) 221 if row.has_key('reg_state') and \ 222 not row['reg_state'] in IMPORTABLE_STATES: 223 if row['reg_state'] not in (IGNORE_MARKER, ''): 224 errs.append(('reg_state','not allowed')) 225 #else: 226 # errs.append(('reg_state','no value provided')) 221 if row.has_key('state') and \ 222 not row['state'] in IMPORTABLE_STATES: 223 if row['state'] not in (IGNORE_MARKER, ''): 224 errs.append(('state','not allowed')) 225 else: 226 # state is an attribute of Student and must not 227 # be changed if empty 228 conv_dict['state'] = IGNORE_MARKER 227 229 return errs, inv_errs, conv_dict 228 230 -
main/waeup.kofa/trunk/src/waeup/kofa/students/student.py
r7949 r8287 156 156 message. 157 157 """ 158 reg_state = IWorkflowState(student).getState()159 if reg_state == CLEARANCE:158 state = IWorkflowState(student).getState() 159 if state == CLEARANCE: 160 160 student.clearance_locked = False 161 161 else: … … 174 174 role_manager.assignRoleToPrincipal( 175 175 'waeup.local.StudentRecordOwner', student.student_id) 176 if reg_state is None:176 if state is None: 177 177 IWorkflowInfo(student).fireTransition('create') 178 178 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data.csv
r8284 r8287 1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex, reg_state1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,sex,state 2 2 X666666,Aaren,Pieri,1,1990-01-02,100000,aa@aa.ng,1234,m,courses validated 3 3 Y777777,Claus,Finau,2,1990-01-03,100001,aa@aa.ng,1234,m,courses validated -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_migration.csv
r8284 r8287 1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,password,sex, reg_state1 student_id,firstname,lastname,reg_number,date_of_birth,matric_number,email,phone,password,sex,state 2 2 A123456,Aaren,Pieri,1,1990-01-02#,100000,aa@aa.ng,1234,mypw1,m,clearance started 3 3 B123456,Aaren,Finau,2,1990-01-03,100001,aa@aa.ng,1234,mypw1,m,cleared -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_student_data_update.csv
r8284 r8287 1 reg_number,date_of_birth,matric_number, reg_state1 reg_number,date_of_birth,matric_number,state 2 2 1,1980-01-02,10,admitted 3 3 2,1980-01-03,11, -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8284 r8287 220 220 def test_checkConversion(self): 221 221 errs, inv_errs, conv_dict = self.processor.checkConversion( 222 dict(reg_number='1', reg_state='admitted'))223 self.assertEqual(len(errs),0) 224 # Empty reg_state is allowed225 errs, inv_errs, conv_dict = self.processor.checkConversion( 226 dict(reg_number='1', reg_state=''))227 self.assertEqual(len(errs),0) 228 #self.assertTrue((' reg_state', 'no value provided') in errs)229 errs, inv_errs, conv_dict = self.processor.checkConversion( 230 dict(reg_number='1', reg_state='nonsense'))222 dict(reg_number='1', state='admitted')) 223 self.assertEqual(len(errs),0) 224 # Empty state is allowed 225 errs, inv_errs, conv_dict = self.processor.checkConversion( 226 dict(reg_number='1', state='')) 227 self.assertEqual(len(errs),0) 228 #self.assertTrue(('state', 'no value provided') in errs) 229 errs, inv_errs, conv_dict = self.processor.checkConversion( 230 dict(reg_number='1', state='nonsense')) 231 231 self.assertEqual(len(errs),1) 232 self.assertTrue((' reg_state', 'not allowed') in errs)232 self.assertTrue(('state', 'not allowed') in errs) 233 233 234 234 def test_delEntry(self): … … 254 254 self.csv_file_update, STUDENT_HEADER_FIELDS_UPDATE, 'update') 255 255 self.assertEqual(num_warns,0) 256 # reg_state has changed256 # state has changed 257 257 self.assertEqual(self.app['students']['X666666'].state,'admitted') 258 # reg_state has not changed258 # state has not changed 259 259 self.assertEqual(self.app['students']['Y777777'].state,'courses validated') 260 260 shutil.rmtree(os.path.dirname(fin_file)) … … 301 301 self.assertEqual( 302 302 content, 303 'reg_number,firstname,student_id,sex,email,phone, date_of_birth,reg_state,lastname,password,matric_number,--ERRORS--\r\n'304 '4,John,D123456,m,aa@aa.ng,1234, 1990-01-05,nonsense,Wolter,mypw1,100003,reg_state: not allowed\r\n'305 '5,John,E123456,x,aa@aa.ng,1234, 1990-01-06,,Kennedy,,100004,sex: Invalid value\r\n'303 'reg_number,firstname,student_id,sex,email,phone,state,date_of_birth,lastname,password,matric_number,--ERRORS--\r\n' 304 '4,John,D123456,m,aa@aa.ng,1234,nonsense,1990-01-05,Wolter,mypw1,100003,state: not allowed\r\n' 305 '5,John,E123456,x,aa@aa.ng,1234,,1990-01-06,Kennedy,,100004,sex: Invalid value\r\n' 306 306 ) 307 307 self.assertTrue('A123456' in self.app['students'].keys()) … … 317 317 self.assertTrue( 318 318 "State 'clearance started' set by system" in history) 319 # reg_state was empty and student is thus in state created319 # state was empty and student is thus in state created 320 320 self.assertEqual(self.app['students']['F123456'].state,'created') 321 321 shutil.rmtree(os.path.dirname(fin_file))
Note: See TracChangeset for help on using the changeset viewer.