Changeset 10275 for main/waeup.futminna
- Timestamp:
- 4 Jun 2013, 16:16:24 (11 years ago)
- Location:
- main/waeup.futminna/trunk/src/waeup/futminna
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.futminna/trunk/src/waeup/futminna/applicants/applicant.py
r10220 r10275 34 34 file_store.deleteFileByContext(applicant, attr='extraform.pdf') 35 35 file_store.deleteFileByContext(applicant, attr='refereeform.pdf') 36 file_store.deleteFileByContext(applicant, attr='credential form.pdf')36 file_store.deleteFileByContext(applicant, attr='credentials.pdf') 37 37 return 38 38 -
main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser.py
r10224 r10275 95 95 html += '<a href="refereeform.pdf">Referee\'s Form</a>, ' 96 96 pdf = getUtility(IExtFileStore).getFileByContext( 97 self.context, attr='credential form.pdf')97 self.context, attr='credentials.pdf') 98 98 if pdf: 99 html += '<a href="credential form.pdf">Credential Form</a>'99 html += '<a href="credentials.pdf">Credentials</a>' 100 100 return html 101 101 … … 129 129 self.extraform_url = self.url(self.context, 'extraform.pdf') 130 130 self.referreeform_url = self.url(self.context, 'refereeform.pdf') 131 self.credential form_url = self.url(self.context, 'credentialform.pdf')131 self.credentials_url = self.url(self.context, 'credentials.pdf') 132 132 return 133 133 … … 204 204 else: 205 205 self.upload_success = False 206 upload_credential form = self.request.form.get('form.credentialform', None)207 if upload_credential form:208 # We got a fresh credential formupload209 success = handle_file_upload( 210 upload_credential form, self.context, self, attr='credentialform.pdf')206 upload_credentials = self.request.form.get('form.credentials', None) 207 if upload_credentials: 208 # We got a fresh credentials upload 209 success = handle_file_upload( 210 upload_credentials, self.context, self, attr='credentials.pdf') 211 211 if success: 212 self.context.writeLogMessage(self, 'saved: credential form')212 self.context.writeLogMessage(self, 'saved: credentials') 213 213 else: 214 214 self.upload_success = False … … 250 250 return _('No referee form pdf file uploaded.') 251 251 if self.target is not None and self.target.startswith('pg') \ 252 and not store.getFileByContext(self.context, attr=u'credential form.pdf'):253 return _('No credential formpdf file uploaded.')252 and not store.getFileByContext(self.context, attr=u'credentials.pdf'): 253 return _('No credentials pdf file uploaded.') 254 254 if not self.request.form.get('confirm_passport', False): 255 255 return _('Passport picture confirmation box not ticked.') … … 277 277 if not success: 278 278 self.upload_success = False 279 upload_credential form = self.request.form.get('form.credentialform', None)280 if upload_credential form:281 # We got a fresh credential formupload282 success = handle_file_upload( 283 upload_credential form, self.context, self, attr='credentialform.pdf')279 upload_credentials = self.request.form.get('form.credentials', None) 280 if upload_credentials: 281 # We got a fresh credentials upload 282 success = handle_file_upload( 283 upload_credentials, self.context, self, attr='credentials.pdf') 284 284 if not success: 285 285 self.upload_success = False … … 313 313 return pdf 314 314 315 class Credential Form(grok.View):315 class Credentials(grok.View): 316 316 """Renders the pdf credential's form for applicants. 317 317 """ 318 grok.name('credential form.pdf')318 grok.name('credentials.pdf') 319 319 grok.context(ICustomApplicant) 320 320 grok.require('waeup.viewApplication') … … 322 322 def render(self): 323 323 pdf = getUtility(IExtFileStore).getFileByContext( 324 self.context, attr='credential form.pdf')324 self.context, attr='credentials.pdf') 325 325 self.response.setHeader('Content-Type', 'application/pdf') 326 326 return pdf -
main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser_templates/applicanteditpage.pt
r10274 r10275 90 90 <tr tal:condition="python: view.target.startswith('pg')"> 91 91 <td class="fieldname" i18n:translate=""> 92 Credential Form:92 Credentials: 93 93 </td> 94 94 <td> 95 <p tal:condition="python: view.file_exists('credential form.pdf')">96 <a href="credential form.pdf"95 <p tal:condition="python: view.file_exists('credentials.pdf')"> 96 <a href="credentials.pdf" 97 97 i18n:translate=""> 98 98 Download pdf file 99 99 </a> 100 100 </p> 101 <input type="file" name="form.credential form" />101 <input type="file" name="form.credentials" /> 102 102 <br /> 103 103 <span i18n:translate=""> -
main/waeup.futminna/trunk/src/waeup/futminna/applicants/interfaces.py
r10274 r10275 231 231 readonly = False, 232 232 ) 233 pp_school = schema.Choice( 234 title = _(u'Qualification Obtained'), 235 required = False, 236 readonly = False, 237 vocabulary = exam_types, 238 ) 233 239 course1 = schema.Choice( 234 240 title = _(u'Programme desired'), -
main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py
r10224 r10275 252 252 self.assertTrue(fd is None) 253 253 254 def test_upload_credential form_by_manager(self):254 def test_upload_credentials_by_manager(self): 255 255 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 256 256 self.browser.open(self.manage_path) … … 258 258 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 259 259 pseudo_pdf = StringIO(pdf_content) 260 # This is a ug applicant, thus the credential formis not260 # This is a ug applicant, thus the credentials is not 261 261 # required 262 self.assertFalse('credential form">' in self.browser.contents)262 self.assertFalse('credentials">' in self.browser.contents) 263 263 264 264 # We have to add a pg applicants container … … 288 288 289 289 self.browser.open(self.manage_path_pg) 290 ctrl = self.browser.getControl(name='form.credential form')291 file_ctrl = ctrl.mech_control 292 file_ctrl.add_file(pseudo_pdf, filename='myform.pdf') 293 self.browser.getControl("Save").click() # submit form 294 # Even though the form could not be saved ... 295 self.assertTrue('Required input is missing' in self.browser.contents) 296 # ... the file has been successfully uploaded 297 pdf_url = self.manage_path_pg.replace('manage', 'credential form.pdf')290 ctrl = self.browser.getControl(name='form.credentials') 291 file_ctrl = ctrl.mech_control 292 file_ctrl.add_file(pseudo_pdf, filename='myform.pdf') 293 self.browser.getControl("Save").click() # submit form 294 # Even though the form could not be saved ... 295 self.assertTrue('Required input is missing' in self.browser.contents) 296 # ... the file has been successfully uploaded 297 pdf_url = self.manage_path_pg.replace('manage', 'credentials.pdf') 298 298 self.browser.open(pdf_url) 299 299 self.assertEqual( … … 303 303 storage = getUtility(IExtFileStore) 304 304 file_id = IFileStoreNameChooser(applicant).chooseName( 305 attr='credential form.pdf')305 attr='credentials.pdf') 306 306 # The stored file can be fetched 307 307 fd = storage.getFile(file_id) … … 310 310 # A file link is displayed on the edit view ... 311 311 self.browser.open(self.manage_path_pg) 312 self.assertTrue('<a href="credential form.pdf">' in self.browser.contents)312 self.assertTrue('<a href="credentials.pdf">' in self.browser.contents) 313 313 # ... and on the dislay view 314 314 self.browser.open(self.view_path_pg) 315 self.assertTrue('<a href="credential form.pdf">Credential Form</a>'315 self.assertTrue('<a href="credentials.pdf">Credentials</a>' 316 316 in self.browser.contents) 317 317 # Adding file is properly logged … … 321 321 self.assertTrue( 322 322 'zope.mgr - waeup.futminna.applicants.browser.CustomApplicantManageFormPage' 323 ' - %s - saved: credential form'323 ' - %s - saved: credentials' 324 324 % (applicant.applicant_id) 325 325 in logcontent) -
main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py
r10165 r10275 30 30 # If you enable this, please make sure the external services 31 31 # do exist really and are not bothered by being spammed by a test programme. 32 EXTERNAL_TESTS = True32 EXTERNAL_TESTS = False 33 33 34 34 def external_test(func):
Note: See TracChangeset for help on using the changeset viewer.