Changeset 9273 for main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
- Timestamp:
- 2 Oct 2012, 16:50:57 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r9257 r9273 407 407 return 408 408 409 def getTransitions(self):410 """Return a list of dicts of allowed transition ids and titles.411 412 Each list entry provides keys ``name`` and ``title`` for413 internal name and (human readable) title of a single414 transition.415 """416 allowed_transitions = [t for t in self.wf_info.getManualTransitions()417 if not t[0].startswith('pay')]418 if self.context.is_postgrad:419 allowed_transitions = [t for t in allowed_transitions420 if not t[0] in FORBIDDEN_POSTGRAD_TRANS]421 return [dict(name='', title=_('No transition'))] +[422 dict(name=x, title=y) for x, y in allowed_transitions]423 424 409 @action(_('Save'), style='primary') 425 410 def save(self, **data): … … 440 425 changed_fields = [] 441 426 if password: 442 # Now we know that the form has no errors and can set password ...427 # Now we know that the form has no errors and can set password 443 428 IUserAccount(self.context).setPassword(password) 444 429 changed_fields.append('password') 445 # ... and execute transition446 if form.has_key('transition') and form['transition']:447 transition_id = form['transition']448 self.wf_info.fireTransition(transition_id)449 430 fields_string = ' + '.join(changed_fields) 450 431 self.flash(_('Form has been saved.')) 451 432 if fields_string: 452 433 self.context.writeLogMessage(self, 'saved: % s' % fields_string) 434 return 435 436 class StudentTriggerTransitionFormPage(KofaEditFormPage): 437 """ View to manage student base data 438 """ 439 grok.context(IStudent) 440 grok.name('trigtrans') 441 grok.require('waeup.triggerTransition') 442 grok.template('trigtrans') 443 label = _('Trigger registration transition') 444 pnav = 4 445 446 def getTransitions(self): 447 """Return a list of dicts of allowed transition ids and titles. 448 449 Each list entry provides keys ``name`` and ``title`` for 450 internal name and (human readable) title of a single 451 transition. 452 """ 453 wf_info = IWorkflowInfo(self.context) 454 allowed_transitions = [t for t in wf_info.getManualTransitions() 455 if not t[0].startswith('pay')] 456 if self.context.is_postgrad: 457 allowed_transitions = [t for t in allowed_transitions 458 if not t[0] in FORBIDDEN_POSTGRAD_TRANS] 459 return [dict(name='', title=_('No transition'))] +[ 460 dict(name=x, title=y) for x, y in allowed_transitions] 461 462 @action(_('Save'), style='primary') 463 def save(self, **data): 464 form = self.request.form 465 if form.has_key('transition') and form['transition']: 466 transition_id = form['transition'] 467 wf_info = IWorkflowInfo(self.context) 468 wf_info.fireTransition(transition_id) 453 469 return 454 470
Note: See TracChangeset for help on using the changeset viewer.