Changeset 6779
- Timestamp:
- 15 Sep 2011, 12:05:59 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6776 r6779 349 349 IUserAccount(self.context).setPassword(form['password']) 350 350 self.context.loggerInfo(ob_class, 'password changed') 351 self.reg_number = form.get('form.reg_number', None) 352 if self.reg_number: 353 hitlist = search(query=self.reg_number,searchtype='reg_number', view=self) 354 355 if hitlist and hitlist[0].student_id != self.context.student_id: 356 self.flash('Registration number exists.') 357 return 358 self.matric_number = form.get('form.matric_number', None) 359 if self.matric_number: 360 hitlist = search(query=self.matric_number, 361 searchtype='matric_number', view=self) 362 if hitlist and hitlist[0].student_id != self.context.student_id: 363 self.flash('Matriculation number exists.') 364 return 351 365 # Turn list of lists into single list 352 366 changed_fields = self.applyData(self.context, **data) 353 367 if changed_fields: 354 368 changed_fields = reduce(lambda x,y: x+y, changed_fields.values()) 355 changed_fields = [x for x in changed_fields356 if not x.startswith('password')]357 369 fields_string = ' + '.join(changed_fields) 358 370 self.context._p_changed = True -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6775 r6779 173 173 self.assertTrue('Student record created' in self.browser.contents) 174 174 175 # Registration numbers must be unique 176 #self.browser.getLink("Manage").click() 177 #self.browser.getControl(name="form.reg_number").value = '123' 178 #self.browser.getControl("Save").click() 179 #self.assertMatches('...value already exists in catalog...', 180 # self.browser.contents) 175 # Registration and matric numbers must be unique 176 self.browser.getLink("Manage").click() 177 self.browser.getControl(name="form.reg_number").value = '123' 178 self.browser.getControl("Save").click() 179 self.assertMatches('...Registration number exists...', 180 self.browser.contents) 181 self.browser.getControl(name="form.reg_number").value = '789' 182 self.browser.getControl(name="form.matric_number").value = '234' 183 self.browser.getControl("Save").click() 184 self.assertMatches('...Matriculation number exists...', 185 self.browser.contents) 181 186 182 187 self.browser.open(self.container_path) … … 233 238 self.browser.getControl(name="transition").value = ['admit'] 234 239 self.browser.getControl(name="form.name").value = 'John Tester' 235 self.browser.getControl(name="form.reg_number").value = ' 123'240 self.browser.getControl(name="form.reg_number").value = '345' 236 241 self.browser.getControl(name="password").value = 'secret' 237 242 self.browser.getControl(name="control_password").value = 'secret'
Note: See TracChangeset for help on using the changeset viewer.