Changeset 13552 for main/waeup.uniben/trunk/src/waeup/uniben
- Timestamp:
- 21 Dec 2015, 08:43:49 (9 years ago)
- Location:
- main/waeup.uniben/trunk/src/waeup/uniben/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.uniben/trunk/src/waeup/uniben/applicants/browser.py
r12085 r13552 22 22 from zope.component import getUtility, createObject 23 23 from zope.security import checkPermission 24 from zope.i18n import translate 24 25 from hurry.workflow.interfaces import IWorkflowState 25 26 from waeup.kofa.browser.layout import action, UtilityView 26 from waeup.kofa.interfaces import IExtFileStore 27 from waeup.kofa.interfaces import IExtFileStore, IKofaUtils 27 28 from waeup.kofa.applicants.browser import ( 28 29 ApplicantRegistrationPage, ApplicantsContainerPage, … … 36 37 NigeriaApplicantManageFormPage, 37 38 NigeriaPDFApplicationSlip) 39 from waeup.kofa.applicants.pdf import PDFApplicationSlip 38 40 from waeup.uniben.applicants.interfaces import ( 39 41 ICustomApplicant) … … 231 233 """ Approval view 232 234 """ 233 234 235 235 236 def update(self): … … 263 264 """ 264 265 265 266 266 def update(self): 267 267 super(CustomExportPDFPageApplicationSlip, self).update() … … 273 273 return self.redirect(self.url(self.context)) 274 274 return 275 276 class CustomPDFApplicationSlip(PDFApplicationSlip): 277 278 @property 279 def title(self): 280 container_title = self.context.__parent__.title 281 portal_language = getUtility(IKofaUtils).PORTAL_LANGUAGE 282 ar_translation = translate(_('Application Record'), 283 'waeup.kofa', target_language=portal_language) 284 if 'affilasa' in self.target: 285 return 'Federal College of Education (Technical) Asaba - %s %s %s' % ( 286 container_title, ar_translation, 287 self.context.application_number) 288 if 'affilako' in self.target: 289 return 'Federal College of Education (Technical) Akoka - %s %s %s' % ( 290 container_title, ar_translation, 291 self.context.application_number) 292 return '%s - %s %s' % (container_title, 293 ar_translation, self.context.application_number) -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_browser.py
r13081 r13552 19 19 Test the applicant-related UI components. 20 20 """ 21 import os 21 22 from StringIO import StringIO 22 23 from datetime import datetime 23 24 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 24 25 from zope.securitypolicy.interfaces import IPrincipalRoleManager 26 from waeup.kofa.browser.tests.test_pdf import samples_dir 27 from waeup.kofa.applicants.container import ApplicantsContainer 25 28 from waeup.uniben.testing import FunctionalLayer 26 29 from waeup.uniben.configuration import CustomSessionConfiguration … … 160 163 'application/pdf') 161 164 return 165 166 def test_asaba_application_slip(self): 167 168 # Remove required FieldProperty attribute first ... 169 delattr(ApplicantsContainer, 'prefix') 170 # ... and replace by asaba 171 self.applicantscontainer.prefix = 'affilasa' 172 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 173 self.slip_path = self.view_path + '/application_slip.pdf' 174 self.browser.open(self.manage_path) 175 self.assertEqual(self.browser.headers['Status'], '200 Ok') 176 self.fill_correct_values() 177 self.browser.getControl("Save").click() 178 IWorkflowState(self.applicant).setState('submitted') 179 self.browser.open(self.manage_path) 180 self.browser.getLink("Download application slip").click() 181 self.assertEqual(self.browser.headers['Status'], '200 Ok') 182 self.assertEqual(self.browser.headers['Content-Type'], 183 'application/pdf') 184 path = os.path.join(samples_dir(), 'application_slip.pdf') 185 open(path, 'wb').write(self.browser.contents) 186 print "Sample application_slip.pdf written to %s" % path -
main/waeup.uniben/trunk/src/waeup/uniben/applicants/utils.py
r13550 r13552 48 48 'pre': ['Pre-Degree Studies', 'PRE'], 49 49 'cbt': ['UNIBEN CBT Practice Test', 'CBT'], 50 'a saba': ['Asaba Programmes', 'ASA'],51 'a koka': ['Akoka Programmes', 'AKO'],50 'affilasa': ['Asaba Programmes', 'ASA'], 51 'affilako': ['Akoka Programmes', 'AKO'], 52 52 } 53 53
Note: See TracChangeset for help on using the changeset viewer.