Ignore:
Timestamp:
4 Jun 2013, 16:16:24 (11 years ago)
Author:
Henrik Bettermann
Message:

Rename credentials form.

Extend interface: add post primary qualification select box.

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  
    3434    file_store.deleteFileByContext(applicant, attr='extraform.pdf')
    3535    file_store.deleteFileByContext(applicant, attr='refereeform.pdf')
    36     file_store.deleteFileByContext(applicant, attr='credentialform.pdf')
     36    file_store.deleteFileByContext(applicant, attr='credentials.pdf')
    3737    return
    3838
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser.py

    r10224 r10275  
    9595            html += '<a href="refereeform.pdf">Referee\'s Form</a>, '
    9696        pdf = getUtility(IExtFileStore).getFileByContext(
    97             self.context, attr='credentialform.pdf')
     97            self.context, attr='credentials.pdf')
    9898        if pdf:
    99             html += '<a href="credentialform.pdf">Credential Form</a>'
     99            html += '<a href="credentials.pdf">Credentials</a>'
    100100        return html
    101101
     
    129129        self.extraform_url = self.url(self.context, 'extraform.pdf')
    130130        self.referreeform_url = self.url(self.context, 'refereeform.pdf')
    131         self.credentialform_url = self.url(self.context, 'credentialform.pdf')
     131        self.credentials_url = self.url(self.context, 'credentials.pdf')
    132132        return
    133133
     
    204204            else:
    205205                self.upload_success = False
    206         upload_credentialform = self.request.form.get('form.credentialform', None)
    207         if upload_credentialform:
    208             # We got a fresh credentialform upload
    209             success = handle_file_upload(
    210                 upload_credentialform, 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')
    211211            if success:
    212                 self.context.writeLogMessage(self, 'saved: credentialform')
     212                self.context.writeLogMessage(self, 'saved: credentials')
    213213            else:
    214214                self.upload_success = False
     
    250250            return _('No referee form pdf file uploaded.')
    251251        if self.target is not None and self.target.startswith('pg') \
    252             and not store.getFileByContext(self.context, attr=u'credentialform.pdf'):
    253             return _('No credential form pdf file uploaded.')
     252            and not store.getFileByContext(self.context, attr=u'credentials.pdf'):
     253            return _('No credentials pdf file uploaded.')
    254254        if not self.request.form.get('confirm_passport', False):
    255255            return _('Passport picture confirmation box not ticked.')
     
    277277            if not success:
    278278                self.upload_success = False
    279         upload_credentialform = self.request.form.get('form.credentialform', None)
    280         if upload_credentialform:
    281             # We got a fresh credentialform upload
    282             success = handle_file_upload(
    283                 upload_credentialform, 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')
    284284            if not success:
    285285                self.upload_success = False
     
    313313        return pdf
    314314
    315 class CredentialForm(grok.View):
     315class Credentials(grok.View):
    316316    """Renders the pdf credential's form for applicants.
    317317    """
    318     grok.name('credentialform.pdf')
     318    grok.name('credentials.pdf')
    319319    grok.context(ICustomApplicant)
    320320    grok.require('waeup.viewApplication')
     
    322322    def render(self):
    323323        pdf = getUtility(IExtFileStore).getFileByContext(
    324             self.context, attr='credentialform.pdf')
     324            self.context, attr='credentials.pdf')
    325325        self.response.setHeader('Content-Type', 'application/pdf')
    326326        return pdf
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser_templates/applicanteditpage.pt

    r10274 r10275  
    9090      <tr tal:condition="python: view.target.startswith('pg')">
    9191        <td class="fieldname" i18n:translate="">
    92           Credential Form:
     92          Credentials:
    9393        </td>
    9494        <td>
    95           <p tal:condition="python: view.file_exists('credentialform.pdf')">
    96             <a href="credentialform.pdf"
     95          <p tal:condition="python: view.file_exists('credentials.pdf')">
     96            <a href="credentials.pdf"
    9797               i18n:translate="">
    9898              Download pdf file
    9999            </a>
    100100          </p>
    101           <input type="file" name="form.credentialform" />
     101          <input type="file" name="form.credentials" />
    102102          <br />
    103103          <span i18n:translate="">
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/interfaces.py

    r10274 r10275  
    231231        readonly = False,
    232232        )
     233    pp_school = schema.Choice(
     234        title = _(u'Qualification Obtained'),
     235        required = False,
     236        readonly = False,
     237        vocabulary = exam_types,
     238        )
    233239    course1 = schema.Choice(
    234240        title = _(u'Programme desired'),
  • main/waeup.futminna/trunk/src/waeup/futminna/applicants/tests/test_browser.py

    r10224 r10275  
    252252        self.assertTrue(fd is None)
    253253
    254     def test_upload_credentialform_by_manager(self):
     254    def test_upload_credentials_by_manager(self):
    255255        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    256256        self.browser.open(self.manage_path)
     
    258258        pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
    259259        pseudo_pdf = StringIO(pdf_content)
    260         # This is a ug applicant, thus the credential form is not
     260        # This is a ug applicant, thus the credentials is not
    261261        # required
    262         self.assertFalse('credentialform">' in self.browser.contents)
     262        self.assertFalse('credentials">' in self.browser.contents)
    263263
    264264        # We have to add a pg applicants container
     
    288288
    289289        self.browser.open(self.manage_path_pg)
    290         ctrl = self.browser.getControl(name='form.credentialform')
    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', 'credentialform.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')
    298298        self.browser.open(pdf_url)
    299299        self.assertEqual(
     
    303303        storage = getUtility(IExtFileStore)
    304304        file_id = IFileStoreNameChooser(applicant).chooseName(
    305             attr='credentialform.pdf')
     305            attr='credentials.pdf')
    306306        # The stored file can be fetched
    307307        fd = storage.getFile(file_id)
     
    310310        # A file link is displayed on the edit view ...
    311311        self.browser.open(self.manage_path_pg)
    312         self.assertTrue('<a href="credentialform.pdf">' in self.browser.contents)
     312        self.assertTrue('<a href="credentials.pdf">' in self.browser.contents)
    313313        # ... and on the dislay view
    314314        self.browser.open(self.view_path_pg)
    315         self.assertTrue('<a href="credentialform.pdf">Credential Form</a>'
     315        self.assertTrue('<a href="credentials.pdf">Credentials</a>'
    316316            in self.browser.contents)
    317317        # Adding file is properly logged
     
    321321        self.assertTrue(
    322322            'zope.mgr - waeup.futminna.applicants.browser.CustomApplicantManageFormPage'
    323             ' - %s - saved: credentialform'
     323            ' - %s - saved: credentials'
    324324            % (applicant.applicant_id)
    325325            in logcontent)
  • main/waeup.futminna/trunk/src/waeup/futminna/interswitch/tests.py

    r10165 r10275  
    3030#   If you enable this, please make sure the external services
    3131#   do exist really and are not bothered by being spammed by a test programme.
    32 EXTERNAL_TESTS = True
     32EXTERNAL_TESTS = False
    3333
    3434def external_test(func):
Note: See TracChangeset for help on using the changeset viewer.