Changeset 16251 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 29 Sep 2020, 06:31:26 (4 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r16194 r16251 702 702 mapping = {'a':self.context.display_fullname}) 703 703 704 class ExportPDF BaseDataPlusSlip(UtilityView, grok.View):704 class ExportPDFStudyCourseBaseDataSlip(UtilityView, grok.View): 705 705 """Deliver a PDF base and studycourse data slip. 706 706 """ 707 707 grok.context(IStudentStudyCourse) 708 grok.name(' basedata_slip.pdf')708 grok.name('studycourse_slip.pdf') 709 709 grok.require('waeup.viewStudent') 710 710 prefix = 'form' … … 740 740 self.context.student, studentview, 741 741 omit_fields=self.omit_fields) 742 743 class ExportPDFPersonalDataSlip(UtilityView, grok.View): 744 """Deliver a PDF base and personal data slip. 745 """ 746 grok.context(IStudent) 747 grok.name('personal_slip.pdf') 748 grok.require('waeup.viewStudent') 749 prefix = 'form' 750 751 omit_fields = ( 752 'suspended', 753 'adm_code', 'suspended_comment', 754 'current_level', 755 'flash_notice', 'entry_session', 756 'parents_email') 757 758 form_fields = grok.AutoFields(IStudentPersonal) 759 760 @property 761 def title(self): 762 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 763 return translate(_('Personal Data'), 'waeup.kofa', 764 target_language=portal_language) 765 766 @property 767 def label(self): 768 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 769 return translate(_('Personal Data of'), 770 'waeup.kofa', target_language=portal_language) \ 771 + ' %s' % self.context.student.display_fullname 772 773 def render(self): 774 studentview = StudentBasePDFFormPage(self.context.student, 775 self.request, self.omit_fields) 776 students_utils = getUtility(IStudentsUtils) 777 return students_utils.renderPDF( 778 self, 'personal_slip.pdf', 779 self.context.student, studentview, 780 omit_fields=self.omit_fields) 781 742 782 743 783 class ExportPDFClearanceSlip(grok.View): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r16248 r16251 2768 2768 return 2769 2769 2770 def test_student_ basedata_slip(self):2770 def test_student_studycourse_slip(self): 2771 2771 IWorkflowState(self.student).setState('school fee paid') 2772 2772 self.browser.open(self.login_path) … … 2774 2774 self.browser.getControl(name="form.password").value = 'spwd' 2775 2775 self.browser.getControl("Login").click() 2776 # Students can open base data slip2776 # Students can open study course base data slip 2777 2777 # (no button available in base package) 2778 pdf_url = '%s/ basedata_slip.pdf' % self.studycourse_path2778 pdf_url = '%s/studycourse_slip.pdf' % self.studycourse_path 2779 2779 self.browser.open(pdf_url) 2780 2780 self.assertEqual(self.browser.headers['Status'], '200 Ok') 2781 2781 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 2782 path = os.path.join(samples_dir(), ' basedata_slip.pdf')2782 path = os.path.join(samples_dir(), 'studycourse_slip.pdf') 2783 2783 open(path, 'wb').write(self.browser.contents) 2784 print "Sample PDF basedata_slip.pdf written to %s" % path 2784 print "Sample PDF studycourse_slip.pdf written to %s" % path 2785 2786 def test_student_personal_slip(self): 2787 IWorkflowState(self.student).setState('school fee paid') 2788 self.browser.open(self.login_path) 2789 self.browser.getControl(name="form.login").value = self.student_id 2790 self.browser.getControl(name="form.password").value = 'spwd' 2791 self.browser.getControl("Login").click() 2792 # Students can personal data slip 2793 # (no button available in base package) 2794 pdf_url = '%s/personal_slip.pdf' % self.student_path 2795 self.browser.open(pdf_url) 2796 self.assertEqual(self.browser.headers['Status'], '200 Ok') 2797 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 2798 path = os.path.join(samples_dir(), 'personal_slip.pdf') 2799 open(path, 'wb').write(self.browser.contents) 2800 print "Sample PDF personal_slip.pdf written to %s" % path 2785 2801 2786 2802 def test_student_clearance(self):
Note: See TracChangeset for help on using the changeset viewer.