Changeset 13489 for main/waeup.aaue
- Timestamp:
- 20 Nov 2015, 10:23:08 (9 years ago)
- Location:
- main/waeup.aaue/trunk/src/waeup/aaue/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py
r13463 r13489 335 335 336 336 @property 337 def title(self): 338 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 339 return translate(_('Matriculation Number'), 'waeup.kofa', 340 target_language=portal_language) 341 342 @property 337 343 def label(self): 338 344 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE … … 355 361 pre_text=pre_text, post_text='') 356 362 363 class ExportPersonalDataSlip(UtilityView, grok.View): 364 """Deliver a PDF notification slip. 365 """ 366 grok.context(ICustomStudent) 367 grok.name('personal_data_slip.pdf') 368 grok.require('waeup.viewStudent') 369 prefix = 'form' 370 note = None 371 372 form_fields = grok.AutoFields(ICustomStudentPersonal).omit('personal_updated') 373 omit_fields = ('suspended', 'suspended_comment', 'adm_code', 'certificate') 374 375 @property 376 def title(self): 377 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 378 return translate(_('Personal Data'), 'waeup.kofa', 379 target_language=portal_language) 380 381 @property 382 def label(self): 383 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 384 return translate(_('Personal Data Slip\n'), 385 'waeup.kofa', target_language=portal_language) \ 386 + ' %s' % self.context.display_fullname 387 388 def render(self): 389 studentview = StudentBasePDFFormPage(self.context.student, 390 self.request, self.omit_fields) 391 students_utils = getUtility(IStudentsUtils) 392 return students_utils.renderPDF(self, 'personal_data_slip.pdf', 393 self.context.student, studentview, note=self.note, 394 omit_fields=self.omit_fields) 395 357 396 class CustomAccommodationManageFormPage(NigeriaAccommodationManageFormPage): 358 397 """ Page to manage bed tickets. -
main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
r13462 r13489 499 499 return 500 500 501 def test_personal_data_slip(self): 502 # Login as student 503 self.browser.open(self.login_path) 504 IWorkflowState(self.student).setState('school fee paid') 505 self.browser.open(self.login_path) 506 self.browser.getControl(name="form.login").value = self.student_id 507 self.browser.getControl(name="form.password").value = 'spwd' 508 self.browser.getControl("Login").click() 509 self.browser.getLink("Personal Data").click() 510 self.assertRaises( 511 LinkNotFoundError, 512 self.browser.getLink, 'Download personal data slip') 513 self.student.father_name = u'Rudolf' 514 self.browser.open(self.personal_path) 515 self.browser.getLink("Download personal data slip").click() 516 self.assertEqual(self.browser.headers['Status'], '200 Ok') 517 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 518 path = os.path.join(samples_dir(), 'personal_data_slip.pdf') 519 open(path, 'wb').write(self.browser.contents) 520 print "Sample PDF personal_data_slip.pdf written to %s" % path 521 return 522 501 523 def test_student_course_registration(self): 502 524 IWorkflowState(self.student).setState('school fee paid') -
main/waeup.aaue/trunk/src/waeup/aaue/students/viewlets.py
r13380 r13489 28 28 from waeup.kofa.students.browser import StudyLevelDisplayFormPage 29 29 30 from waeup.aaue.students.interfaces import ICustomStudentStudyLevel 30 from waeup.aaue.students.interfaces import ( 31 ICustomStudent, ICustomStudentStudyLevel) 32 from waeup.aaue.students.browser import CustomStudentPersonalDisplayFormPage 31 33 from waeup.aaue.interfaces import MessageFactory as _ 32 34 … … 98 100 return self.view.url(self.view.context, self.target) 99 101 102 class PersonalDataSlipActionButton(ManageActionButton): 103 grok.order(3) 104 grok.context(ICustomStudent) 105 grok.view(CustomStudentPersonalDisplayFormPage) 106 grok.require('waeup.viewStudent') 107 icon = 'actionicon_pdf.png' 108 text = _('Download personal data slip') 109 target = 'personal_data_slip.pdf' 110 111 @property 112 def target_url(self): 113 if not self.context.father_name: 114 return '' 115 return self.view.url(self.view.context, self.target) 116 100 117 class StudentPassportActionButton(StudentPassportActionButton): 101 118 """Inherit from same class in base package, not from kofacustom.nigeria
Note: See TracChangeset for help on using the changeset viewer.