Changeset 15942 for main/kofacustom.iuokada/trunk/src
- Timestamp:
- 20 Jan 2020, 17:23:31 (5 years ago)
- 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 32 32 """ 33 33 file_store = getUtility(IExtFileStore) 34 file_store.deleteFileByContext(applicant, attr=' stateresult.pdf')34 file_store.deleteFileByContext(applicant, attr='res_stat.pdf') 35 35 return 36 36 -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser.py
r15884 r15942 126 126 html = '' 127 127 pdf = getUtility(IExtFileStore).getFileByContext( 128 self.context, attr=' stateresult.pdf')128 self.context, attr='res_stat.pdf') 129 129 if pdf: 130 130 html += '<a href="%s">Statement of Result</a>' % self.url( 131 self.context, ' stateresult.pdf')131 self.context, 'res_stat.pdf') 132 132 return html 133 133 … … 174 174 def update(self): 175 175 super(CustomApplicantManageFormPage, self).update() 176 upload_ stateresult = self.request.form.get('form.stateresult', None)177 if upload_ stateresult:178 # We got a fresh stateresult upload176 upload_res_stat = self.request.form.get('form.res_stat', None) 177 if upload_res_stat: 178 # We got a fresh res_stat upload 179 179 success = handle_file_upload( 180 upload_ stateresult, self.context, self, attr='stateresult.pdf')180 upload_res_stat, self.context, self, attr='res_stat.pdf') 181 181 if success: 182 self.context.writeLogMessage(self, 'saved: stateresult')182 self.context.writeLogMessage(self, 'saved: res_stat') 183 183 else: 184 184 self.upload_success = False … … 199 199 return _('Passport picture confirmation box not ticked.') 200 200 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'): 202 202 return _('No statement of result pdf file uploaded.') 203 203 return False … … 224 224 return 225 225 super(CustomApplicantEditFormPage, self).update() 226 upload_ stateresult = self.request.form.get('form.stateresult', None)227 if upload_ stateresult:228 # We got a fresh stateresult upload226 upload_res_stat = self.request.form.get('form.res_stat', None) 227 if upload_res_stat: 228 # We got a fresh res_stat upload 229 229 success = handle_file_upload( 230 upload_ stateresult, self.context, self, attr='stateresult.pdf')230 upload_res_stat, self.context, self, attr='res_stat.pdf') 231 231 if not success: 232 232 self.upload_success = False … … 256 256 return form_fields 257 257 258 class StateResult(grok.View):258 class ResultStatement(grok.View): 259 259 """Renders the pdf form extension for applicants. 260 260 """ 261 grok.name(' stateresult.pdf')261 grok.name('res_stat.pdf') 262 262 grok.context(ICustomApplicant) 263 263 grok.require('waeup.viewApplication') … … 265 265 def render(self): 266 266 pdf = getUtility(IExtFileStore).getFileByContext( 267 self.context, attr=' stateresult.pdf')267 self.context, attr='res_stat.pdf') 268 268 self.response.setHeader('Content-Type', 'application/pdf') 269 269 return pdf -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/browser_templates/applicanteditpage.pt
r15878 r15942 43 43 <span tal:replace="view/max_upload_size">10 KB</span> 44 44 </tr> 45 <tr >45 <tr tal:condition="python: view.context.subtype == 'transfer'"> 46 46 <td class="fieldname" i18n:translate=""> 47 47 Statement of Result: 48 48 </td> 49 49 <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" 52 52 i18n:translate=""> 53 53 Download pdf file … … 58 58 <div class="btn btn-default btn-file"> 59 59 Select… 60 <input type="file" name="form. stateresult" />60 <input type="file" name="form.res_stat" /> 61 61 </div> 62 62 </div> -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/tests/test_browser.py
r15878 r15942 102 102 print "Sample application_slip.pdf written to %s" % path 103 103 104 def test_upload_ stateresult_by_manager(self):104 def test_upload_res_stat_by_manager(self): 105 105 # Add trans applicants container 106 106 self.transcontainer = ApplicantsContainer() … … 134 134 pdf_content = 'A' * 1024 * 300 # A string of 300 KB size 135 135 pseudo_pdf = StringIO(pdf_content) 136 ctrl = self.browser.getControl(name='form. stateresult')136 ctrl = self.browser.getControl(name='form.res_stat') 137 137 file_ctrl = ctrl.mech_control 138 138 file_ctrl.add_file(pseudo_pdf, filename='myform.pdf') … … 141 141 self.assertTrue('Required input is missing' in self.browser.contents) 142 142 # ... 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') 144 144 self.browser.open(pdf_url) 145 145 self.assertEqual( … … 149 149 storage = getUtility(IExtFileStore) 150 150 file_id = IFileStoreNameChooser(self.transapplicant).chooseName( 151 attr=' stateresult.pdf')151 attr='res_stat.pdf') 152 152 # The stored file can be fetched 153 153 fd = storage.getFile(file_id) … … 156 156 # A file link is displayed on the edit view ... 157 157 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) 159 159 # ... and on the dislay view 160 160 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>' 162 162 in self.browser.contents) 163 163 # Adding file is properly logged … … 167 167 self.assertTrue( 168 168 'zope.mgr - kofacustom.iuokada.applicants.browser.CustomApplicantManageFormPage' 169 ' - %s - saved: stateresult'169 ' - %s - saved: res_stat' 170 170 % (self.transapplicant.applicant_id) 171 171 in logcontent) -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/applicants/utils.py
r15886 r15942 29 29 """A collection of parameters and methods subject to customization. 30 30 """ 31 32 #: A tuple of names of files to be copied over 33 #: to students section. 34 FILENAMES = ('res_stat.pdf',) 31 35 32 36 APP_TYPES_DICT = { -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/interfaces.py
r15937 r15942 192 192 ) 193 193 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 # ) 199 199 200 200 iuits_fee = schema.Float( -
main/kofacustom.iuokada/trunk/src/kofacustom/iuokada/students/viewlets.py
r15859 r15942 98 98 title = _(u'Signature Scan') 99 99 download_name = u'signature' 100 tab_redirect = '?tab2'101 100 102 101 class SignatureImage(StudentImage): 103 """Renders acceptance letterscan.102 """Renders signature scan. 104 103 """ 105 104 grok.name('signature')
Note: See TracChangeset for help on using the changeset viewer.