Changeset 6638 for main/waeup.sirp/trunk
- Timestamp:
- 27 Aug 2011, 14:14:47 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/students
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r6637 r6638 322 322 grok.require('waeup.manageStudents') 323 323 form_fields = grok.AutoFields(IStudentBase).omit('student_id') 324 #grok.template('editstudentbase')324 grok.template('studentbasemanagepage') 325 325 label = 'Edit base data' 326 326 327 @property 328 def title(self): 329 return 'Student: %s' % self.context.name 327 def update(self): 328 datepicker.need() # Enable jQuery datepicker in date fields. 329 super(StudentBaseManageFormPage, self).update() 330 self.wf_info = IWorkflowInfo(self.context) 331 return 332 333 @property 334 def title(self): 335 return 'Student: %s' % self.context.name 336 337 def getTransitions(self): 338 """Return a list of dicts of allowed transition ids and titles. 339 340 Each list entry provides keys ``name`` and ``title`` for 341 internal name and (human readable) title of a single 342 transition. 343 """ 344 allowed_transitions = self.wf_info.getManualTransitions() 345 return [dict(name='', title='No transition')] +[ 346 dict(name=x, title=y) for x, y in allowed_transitions] 347 348 @grok.action('Save') 349 def save(self, **data): 350 changed_fields = self.applyData(self.context, **data) 351 changed_fields = changed_fields.values() 352 fields_string = '+'.join(' + '.join(str(i) for i in b) for b in changed_fields) 353 self.context._p_changed = True 354 form = self.request.form 355 if form.has_key('transition') and form['transition']: 356 transition_id = form['transition'] 357 self.wf_info.fireTransition(transition_id) 358 self.flash('Form has been saved.') 359 ob_class = self.__implemented__.__name__.replace('waeup.sirp.','') 360 self.context.loggerInfo(ob_class, 'saved: % s' % fields_string) 361 return 330 362 331 363 class StudentClearanceDisplayFormPage(WAeUPDisplayFormPage): -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r6637 r6638 200 200 self.assertEqual(self.browser.headers['Status'], '200 Ok') 201 201 self.assertEqual(self.browser.url, self.manage_student_path) 202 # Managers can fire transitions 203 self.browser.getControl(name="transition").value = ['admit'] 204 self.browser.getControl("Save").click() 205 self.assertTrue('Form has been saved' in self.browser.contents) 202 206 203 207 self.browser.open(self.student_path) … … 236 240 self.assertEqual(self.browser.headers['Status'], '200 Ok') 237 241 self.assertEqual(self.browser.url, self.history_student_path) 238 self.assertMatches('...Student object created by system...', self.browser.contents)242 self.assertMatches('...Student admitted by system...', self.browser.contents) 239 243 240 244 return -
main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py
r6637 r6638 18 18 source = None, 19 19 condition = NullCondition, 20 msg = 'Student objectcreated',20 msg = 'Student record created', 21 21 destination = CREATED), 22 22 … … 31 31 transition_id = 'reset1', 32 32 title = 'Reset student', 33 msg = 'Student re set',33 msg = 'Student record reset', 34 34 source = ADMITTED, 35 35 destination = CREATED),
Note: See TracChangeset for help on using the changeset viewer.