Ignore:
Timestamp:
25 Jun 2013, 12:46:38 (11 years ago)
Author:
Henrik Bettermann
Message:

Change notice and remove upload fields.

Location:
main/waeup.imostate/trunk/src/waeup/imostate/applicants
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.imostate/trunk/src/waeup/imostate/applicants/browser.py

    r10380 r10382  
    215215        if not store.getFileByContext(self.context, attr=u'extraform.pdf'):
    216216            return _('No extra information form pdf file uploaded.')
    217         if not store.getFileByContext(self.context, attr=u'refereeform.pdf'):
    218             return _('No referee form pdf file uploaded.')
    219         if self.target is not None and self.target.startswith('pg') \
    220             and not store.getFileByContext(self.context, attr=u'credentials.pdf'):
    221             return _('No credentials pdf file uploaded.')
     217        #if not store.getFileByContext(self.context, attr=u'refereeform.pdf'):
     218        #    return _('No referee form pdf file uploaded.')
     219        #if self.target is not None and self.target.startswith('pg') \
     220        #    and not store.getFileByContext(self.context, attr=u'credentials.pdf'):
     221        #    return _('No credentials pdf file uploaded.')
    222222        if not self.request.form.get('confirm_passport', False):
    223223            return _('Passport picture confirmation box not ticked.')
  • main/waeup.imostate/trunk/src/waeup/imostate/applicants/browser_templates/applicanteditpage.pt

    r10381 r10382  
    2020      <a href="https://imostate.waeup.org/downloads/AttestationForm.pdf"
    2121        i18n:translate="">
    22     <strong>Attestation Form</strong></a>.
    23     Then scan the filled form together with other
    24     documents required for application:
    25     (1) Local Government Certificate of Indegen,
     22    <strong>Attestation Form</strong></a>then,
     23    upload a scanned copy of the filled attestation form.
     24    Also, scan the following other documents required for application:
     25    (1) Local Government Certificate of Indigene,
    2626    (2) Credentials and the
    27     (3) NYSC Discharge Certificate. Print these four scanned documents
    28     into a single pdf file and upload the file with the form below.
     27    (3) NYSC Discharge Certificate.
     28    Print these four scanned documents into a single pdf file and
     29    upload the file as Extra Applicant Information Form below.
    2930    <br /><br />
    3031  </p>
     
    6768          </p>
    6869          <input type="file" name="form.extraform" />
    69           <br />
    70           <span i18n:translate="">
    71             Max. file size:
    72           </span>
    73           <span tal:replace="view/max_file_upload_size">10 KB</span>
    74       </tr>
    75       <tr>
    76         <td class="fieldname" i18n:translate="">
    77           Referee's Form:
    78         </td>
    79         <td>
    80           <p tal:condition="python: view.file_exists('refereeform.pdf')">
    81             <a href="refereeform.pdf"
    82                i18n:translate="">
    83               Download pdf file
    84             </a>
    85           </p>
    86           <input type="file" name="form.refereeform" />
    87           <br />
    88           <span i18n:translate="">
    89             Max. file size:
    90           </span>
    91           <span tal:replace="view/max_file_upload_size">10 KB</span>
    92       </tr>
    93       <tr tal:condition="python: view.target.startswith('pg')">
    94         <td class="fieldname" i18n:translate="">
    95           Credentials:
    96         </td>
    97         <td>
    98           <p tal:condition="python: view.file_exists('credentials.pdf')">
    99             <a href="credentials.pdf"
    100                i18n:translate="">
    101               Download pdf file
    102             </a>
    103           </p>
    104           <input type="file" name="form.credentials" />
    10570          <br />
    10671          <span i18n:translate="">
  • main/waeup.imostate/trunk/src/waeup/imostate/applicants/interfaces.py

    r10380 r10382  
    131131        )
    132132
     133ICustomUGApplicant[
     134    'locked'].order =  IApplicantBaseData['suspended'].order
     135ICustomUGApplicant[
     136    'result_uploaded'].order =  ICustomUGApplicant['suspended'].order
     137
    133138class ICustomApplicant(ICustomUGApplicant):
    134139    """An interface for both types of applicants.
  • main/waeup.imostate/trunk/src/waeup/imostate/applicants/tests/test_browser.py

    r10366 r10382  
    161161        self.assertTrue(fd is None)
    162162
    163     def test_upload_refereeform_by_student(self):
    164         self.login()
    165         self.browser.open(self.edit_path)
    166         # Create a pseudo file and select it to be uploaded in form
    167         pdf_content = 'A' * 1024 * 600  # A string of 600 KB size
    168         pseudo_file = StringIO(pdf_content)
    169         ctrl = self.browser.getControl(name='form.refereeform')
    170         file_ctrl = ctrl.mech_control
    171         file_ctrl.add_file(pseudo_file, filename='myform.pdf')
    172         self.browser.getControl("Save").click() # submit form
    173         # We get a warning message
    174         self.assertTrue(
    175             'Uploaded file is too big' in self.browser.contents)
    176         # Create a pseudo file with acceptable size
    177         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
    178         pseudo_file = StringIO(pdf_content)
    179         ctrl = self.browser.getControl(name='form.refereeform')
    180         file_ctrl = ctrl.mech_control
    181         file_ctrl.add_file(pseudo_file, filename='myform.pdf')
    182         self.browser.getControl("Save").click() # submit form
    183         # Even though the form could not be saved ...
    184         self.assertTrue('Required input is missing' in self.browser.contents)
    185         # ... the file has been successfully uploaded
    186         pdf_url = self.edit_path.replace('edit', 'refereeform.pdf')
    187         self.browser.open(pdf_url)
    188         self.assertEqual(
    189             self.browser.headers['content-type'], 'application/pdf')
    190         self.assertEqual(len(self.browser.contents), 307200)
    191         # There is really a file stored for the applicant
    192         storage = getUtility(IExtFileStore)
    193         file_id = IFileStoreNameChooser(self.applicant).chooseName(
    194             attr='refereeform.pdf')
    195         # The stored file can be fetched
    196         fd = storage.getFile(file_id)
    197         file_len = len(fd.read())
    198         self.assertEqual(file_len, 307200)
    199         # A file link is displayed on the edit view ...
    200         self.browser.open(self.edit_path)
    201         self.assertTrue('<a href="refereeform.pdf">' in self.browser.contents)
    202         # ... and on the dislay view
    203         self.browser.open(self.view_path)
    204         self.assertTrue('<a href="refereeform.pdf">Referee\'s Form</a>'
    205             in self.browser.contents)
    206 
    207     def test_upload_refereeform_by_manager(self):
    208         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    209         self.browser.open(self.manage_path)
    210         # Create a pseudo file with acceptable size
    211         pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
    212         pseudo_file = StringIO(pdf_content)
    213         ctrl = self.browser.getControl(name='form.refereeform')
    214         file_ctrl = ctrl.mech_control
    215         file_ctrl.add_file(pseudo_file, filename='myform.pdf')
    216         self.browser.getControl("Save").click() # submit form
    217         # Even though the form could not be saved ...
    218         self.assertTrue('Required input is missing' in self.browser.contents)
    219         # ... the file has been successfully uploaded
    220         pdf_url = self.manage_path.replace('manage', 'refereeform.pdf')
    221         self.browser.open(pdf_url)
    222         self.assertEqual(
    223             self.browser.headers['content-type'], 'application/pdf')
    224         self.assertEqual(len(self.browser.contents), 307200)
    225         # There is rally a file stored for the applicant
    226         storage = getUtility(IExtFileStore)
    227         file_id = IFileStoreNameChooser(self.applicant).chooseName(
    228             attr='refereeform.pdf')
    229         # The stored file can be fetched
    230         fd = storage.getFile(file_id)
    231         file_len = len(fd.read())
    232         self.assertEqual(file_len, 307200)
    233         # A file link is displayed on the edit view ...
    234         self.browser.open(self.manage_path)
    235         self.assertTrue('<a href="refereeform.pdf">' in self.browser.contents)
    236         # ... and on the dislay view
    237         self.browser.open(self.view_path)
    238         self.assertTrue('<a href="refereeform.pdf">Referee\'s Form</a>'
    239             in self.browser.contents)
    240         # Adding file is properly logged
    241         logfile = os.path.join(
    242             self.app['datacenter'].storage, 'logs', 'applicants.log')
    243         logcontent = open(logfile).read()
    244         self.assertTrue(
    245             'zope.mgr - waeup.imostate.applicants.browser.CustomApplicantManageFormPage'
    246             ' - %s - saved: refereeform'
    247             % (self.applicant.applicant_id)
    248             in logcontent)
    249         # When an applicant is removed, also the pdf files are gone.
    250         del self.app['applicants']['app2011'][self.applicant.application_number]
    251         fd = storage.getFile(file_id)
    252         self.assertTrue(fd is None)
    253 
    254163    def test_applicant_workflow(self):
    255164        # Applicants can edit their record
     
    275184        file_ctrl = ctrl.mech_control
    276185        file_ctrl.add_file(pseudo_file, filename='myform.pdf')
    277         ctrl = self.browser.getControl(name='form.refereeform')
    278         file_ctrl = ctrl.mech_control
    279         file_ctrl.add_file(pseudo_file, filename='myform.pdf')
    280186
    281187        self.browser.getControl(name="confirm_passport").value = True
Note: See TracChangeset for help on using the changeset viewer.