Changeset 7028
- Timestamp:
- 8 Nov 2011, 07:21:58 (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
r7027 r7028 642 642 return total_credits 643 643 644 class CourseRegistrationSlipActionButton(ManageActionButton): 645 grok.order(1) 646 grok.context(IStudentStudyLevel) 647 grok.require('waeup.viewStudent') 648 icon = 'actionicon_pdf.png' 649 text = 'Download course registration slip' 650 target = 'course_registration.pdf' 651 652 class ExportPDFCourseRegistrationSlipPage(grok.View): 653 """Deliver a PDF slip of the context. 654 """ 655 grok.context(IStudentStudyLevel) 656 grok.name('course_registration.pdf') 657 grok.require('waeup.viewStudent') 658 form_fields = grok.AutoFields(IStudentStudyLevel) 659 prefix = 'form' 660 661 @property 662 def label(self): 663 return 'Course Registration Slip %s' % self.context.level_title 664 665 def render(self): 666 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 667 self.request) 668 return renderPDF(self,'Course Registration', 'course_registration.pdf', 669 self.context.getStudent, studentview) 670 644 671 class StudyLevelManageActionButton(ManageActionButton): 645 grok.order( 1)672 grok.order(2) 646 673 grok.context(IStudentStudyLevel) 647 674 grok.view(StudyLevelDisplayFormPage) … … 980 1007 981 1008 class PaymentReceiptActionButton(ManageActionButton): 1009 grok.order(1) 982 1010 grok.context(IStudentOnlinePayment) 983 1011 grok.require('waeup.viewStudent') … … 985 1013 text = 'Download payment receipt' 986 1014 target = 'payment_receipt.pdf' 1015 1016 @property 1017 def target_url(self): 1018 if self.context.p_state != 'paid': 1019 return '' 1020 return self.view.url(self.view.context, self.target) 987 1021 988 1022 class OnlinePaymentCallbackPage(grok.View): … … 1051 1085 1052 1086 def render(self): 1087 if self.context.p_state != 'paid': 1088 self.flash('Ticket not yet paid.') 1089 self.redirect(self.url(self.context)) 1090 return 1053 1091 studentview = StudentBaseDisplayFormPage(self.context.getStudent(), 1054 1092 self.request) … … 1266 1304 1267 1305 class BedTicketSlipActionButton(ManageActionButton): 1306 grok.order(1) 1268 1307 grok.context(IBedTicket) 1269 1308 grok.require('waeup.viewStudent') -
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7027 r7028 700 700 payment_url = self.browser.url 701 701 702 # The pdf payment receipt can't yet be opened 703 self.browser.open(payment_url + '/payment_receipt.pdf') 704 self.assertMatches('...Ticket not yet paid...', 705 self.browser.contents) 706 702 707 # The same payment ticket (with same p_item, p_session and p_category) 703 708 # can't be added twice. … … 721 726 722 727 # Managers can open the pdf payment receipt 723 self.browser. open(payment_url + '/payment_receipt.pdf')728 self.browser.getLink("Download payment receipt").click() 724 729 self.assertEqual(self.browser.headers['Status'], '200 Ok') 725 730 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
Note: See TracChangeset for help on using the changeset viewer.