Changeset 7275 for main/waeup.sirp/trunk
- Timestamp:
- 5 Dec 2011, 07:20:41 (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
r7259 r7275 20 20 import sys 21 21 import grok 22 from urllib import urlencode 22 23 from time import time 23 24 from datetime import datetime … … 363 364 grok.context(IStudent) 364 365 grok.name('contactstudent') 365 grok.require('waeup. manageStudent')366 grok.require('waeup.viewStudent') 366 367 pnav = 4 367 368 title = 'Contact' 368 369 form_fields = grok.AutoFields(IContactForm).select('subject', 'body') 370 371 def update(self, subject=u''): 372 self.form_fields.get('subject').field.default = subject 373 self.subject = subject 374 return 369 375 370 376 def label(self): … … 567 573 if self.context.state == CLEARED: 568 574 IWorkflowInfo(self.context).fireTransition('reset4') 569 self.flash('Clearance has been annulled.') 575 message = 'Clearance has been annulled' 576 self.flash(message) 570 577 elif self.context.state == REQUESTED: 571 578 IWorkflowInfo(self.context).fireTransition('reset3') 572 self.flash('Clearance request has been rejected.') 579 message = 'Clearance request has been rejected' 580 self.flash(message) 573 581 else: 574 582 self.flash('Student is in the wrong state.') 575 self.redirect(self.url(self.context,'view_clearance')) 583 return 584 args = {'subject':message} 585 self.redirect(self.url(self.context) + 586 '/contactstudent?%s' % urlencode(args)) 576 587 return 577 588 578 589 def render(self): 579 self.redirect(self.url(self.context, 'view_clearance'))580 590 return 581 591 … … 1752 1762 def requestClearance(self, **data): 1753 1763 self.applyData(self.context, **data) 1754 self.context._p_changed = True1764 #self.context._p_changed = True 1755 1765 if self.dataNotComplete(): 1756 1766 self.flash(self.dataNotComplete()) -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7251 r7275 736 736 self.browser.getLink("Reject clearance").click() 737 737 self.assertTrue('Clearance has been annulled' in self.browser.contents) 738 urlmessage = 'Clearance+has+been+annulled' 739 self.assertEqual(self.browser.url, self.student_path + 740 '/contactstudent?subject=%s' % urlmessage) 738 741 self.assertTrue('State: <span>clearance started</span>' 739 742 in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.