Changeset 15942 for main


Ignore:
Timestamp:
20 Jan 2020, 17:23:31 (5 years ago)
Author:
Henrik Bettermann
Message:

Rename stateresult file and adjust to base package.

Location:
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/applicant.py

    r15878 r15942  
    3232    """
    3333    file_store = getUtility(IExtFileStore)
    34     file_store.deleteFileByContext(applicant, attr='stateresult.pdf')
     34    file_store.deleteFileByContext(applicant, attr='res_stat.pdf')
    3535    return
    3636
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py

    r15884 r15942  
    126126        html = ''
    127127        pdf = getUtility(IExtFileStore).getFileByContext(
    128             self.context, attr='stateresult.pdf')
     128            self.context, attr='res_stat.pdf')
    129129        if pdf:
    130130            html += '<a href="%s">Statement of Result</a>' % self.url(
    131                 self.context, 'stateresult.pdf')
     131                self.context, 'res_stat.pdf')
    132132        return html
    133133
     
    174174    def update(self):
    175175        super(CustomApplicantManageFormPage, self).update()
    176         upload_stateresult = self.request.form.get('form.stateresult', None)
    177         if upload_stateresult:
    178             # We got a fresh stateresult upload
     176        upload_res_stat = self.request.form.get('form.res_stat', None)
     177        if upload_res_stat:
     178            # We got a fresh res_stat upload
    179179            success = handle_file_upload(
    180                 upload_stateresult, self.context, self, attr='stateresult.pdf')
     180                upload_res_stat, self.context, self, attr='res_stat.pdf')
    181181            if success:
    182                 self.context.writeLogMessage(self, 'saved: stateresult')
     182                self.context.writeLogMessage(self, 'saved: res_stat')
    183183            else:
    184184                self.upload_success = False
     
    199199                return _('Passport picture confirmation box not ticked.')
    200200        if self.context.subtype == 'transfer' and \
    201             not store.getFileByContext(self.context, attr=u'stateresult.pdf'):
     201            not store.getFileByContext(self.context, attr=u'res_stat.pdf'):
    202202            return _('No statement of result pdf file uploaded.')
    203203        return False
     
    224224            return
    225225        super(CustomApplicantEditFormPage, self).update()
    226         upload_stateresult = self.request.form.get('form.stateresult', None)
    227         if upload_stateresult:
    228             # We got a fresh stateresult upload
     226        upload_res_stat = self.request.form.get('form.res_stat', None)
     227        if upload_res_stat:
     228            # We got a fresh res_stat upload
    229229            success = handle_file_upload(
    230                 upload_stateresult, self.context, self, attr='stateresult.pdf')
     230                upload_res_stat, self.context, self, attr='res_stat.pdf')
    231231            if not success:
    232232                self.upload_success = False
     
    256256        return form_fields
    257257
    258 class StateResult(grok.View):
     258class ResultStatement(grok.View):
    259259    """Renders the pdf form extension for applicants.
    260260    """
    261     grok.name('stateresult.pdf')
     261    grok.name('res_stat.pdf')
    262262    grok.context(ICustomApplicant)
    263263    grok.require('waeup.viewApplication')
     
    265265    def render(self):
    266266        pdf = getUtility(IExtFileStore).getFileByContext(
    267             self.context, attr='stateresult.pdf')
     267            self.context, attr='res_stat.pdf')
    268268        self.response.setHeader('Content-Type', 'application/pdf')
    269269        return pdf
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser_templates/applicanteditpage.pt

    r15878 r15942  
    4343          <span tal:replace="view/max_upload_size">10 KB</span>
    4444      </tr>
    45       <tr>
     45      <tr tal:condition="python: view.context.subtype == 'transfer'">
    4646        <td class="fieldname" i18n:translate="">
    4747          Statement of Result:
    4848        </td>
    4949        <td>
    50           <p tal:condition="python: view.file_exists('stateresult.pdf')">
    51             <a href="stateresult.pdf"
     50          <p tal:condition="python: view.file_exists('res_stat.pdf')">
     51            <a href="res_stat.pdf"
    5252               i18n:translate="">
    5353              Download pdf file
     
    5858              <div class="btn btn-default btn-file">
    5959                Select&hellip;
    60               <input type="file" name="form.stateresult" />
     60              <input type="file" name="form.res_stat" />
    6161              </div>
    6262            </div>
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/tests/test_browser.py

    r15878 r15942  
    102102        print "Sample application_slip.pdf written to %s" % path
    103103
    104     def test_upload_stateresult_by_manager(self):
     104    def test_upload_res_stat_by_manager(self):
    105105        # Add trans applicants container
    106106        self.transcontainer = ApplicantsContainer()
     
    134134        pdf_content = 'A' * 1024 * 300  # A string of 300 KB size
    135135        pseudo_pdf = StringIO(pdf_content)
    136         ctrl = self.browser.getControl(name='form.stateresult')
     136        ctrl = self.browser.getControl(name='form.res_stat')
    137137        file_ctrl = ctrl.mech_control
    138138        file_ctrl.add_file(pseudo_pdf, filename='myform.pdf')
     
    141141        self.assertTrue('Required input is missing' in self.browser.contents)
    142142        # ... the file has been successfully uploaded
    143         pdf_url = self.transapplicant_manage_path.replace('manage', 'stateresult.pdf')
     143        pdf_url = self.transapplicant_manage_path.replace('manage', 'res_stat.pdf')
    144144        self.browser.open(pdf_url)
    145145        self.assertEqual(
     
    149149        storage = getUtility(IExtFileStore)
    150150        file_id = IFileStoreNameChooser(self.transapplicant).chooseName(
    151             attr='stateresult.pdf')
     151            attr='res_stat.pdf')
    152152        # The stored file can be fetched
    153153        fd = storage.getFile(file_id)
     
    156156        # A file link is displayed on the edit view ...
    157157        self.browser.open(self.transapplicant_manage_path)
    158         self.assertTrue('<a href="stateresult.pdf">' in self.browser.contents)
     158        self.assertTrue('<a href="res_stat.pdf">' in self.browser.contents)
    159159        # ... and on the dislay view
    160160        self.browser.open(self.transapplicant_view_path)
    161         self.assertTrue('stateresult.pdf">Statement of Result</a>'
     161        self.assertTrue('res_stat.pdf">Statement of Result</a>'
    162162            in self.browser.contents)
    163163        # Adding file is properly logged
     
    167167        self.assertTrue(
    168168            'zope.mgr - kofacustom.iuokada.applicants.browser.CustomApplicantManageFormPage'
    169             ' - %s - saved: stateresult'
     169            ' - %s - saved: res_stat'
    170170            % (self.transapplicant.applicant_id)
    171171            in logcontent)
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py

    r15886 r15942  
    2929    """A collection of parameters and methods subject to customization.
    3030    """
     31
     32    #: A tuple of names of files to be copied over
     33    #: to students section.
     34    FILENAMES = ('res_stat.pdf',)
    3135
    3236    APP_TYPES_DICT = {
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interfaces.py

    r15937 r15942  
    192192        )
    193193
    194     make_up_fee = schema.Float(
    195         title = _(u'Make-up Fee'),
    196         default = 0.0,
    197         required = False,
    198         )
     194    #make_up_fee = schema.Float(
     195    #    title = _(u'Make-up Fee'),
     196    #    default = 0.0,
     197    #    required = False,
     198    #    )
    199199
    200200    iuits_fee = schema.Float(
  • main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py

    r15859 r15942  
    9898    title = _(u'Signature Scan')
    9999    download_name = u'signature'
    100     tab_redirect = '?tab2'
    101100
    102101class SignatureImage(StudentImage):
    103     """Renders acceptance letter scan.
     102    """Renders signature scan.
    104103    """
    105104    grok.name('signature')
Note: See TracChangeset for help on using the changeset viewer.