- Timestamp:
- 29 Apr 2013, 08:18:41 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.futminna/trunk/src/waeup/futminna/applicants/browser.py
r10096 r10105 82 82 html = '' 83 83 pdf = getUtility(IExtFileStore).getFileByContext( 84 self.context, attr=' formextension.pdf')84 self.context, attr='extraform.pdf') 85 85 if pdf: 86 html += '<a href="formextension.pdf">Offline Form Extension</a>' 86 html += '<a href="extraform.pdf">Extra Applicant Information Form</a>, ' 87 pdf = getUtility(IExtFileStore).getFileByContext( 88 self.context, attr='refereeform.pdf') 89 if pdf: 90 html += '<a href="refereeform.pdf">Referee\'s Form</a>' 87 91 return html 88 92 … … 113 117 def update(self): 114 118 super(CustomApplicantDisplayFormPage, self).update() 115 self.formextension_url = self.url(self.context, 'formextension.pdf') 119 self.extraform_url = self.url(self.context, 'extraform.pdf') 120 self.referreeform_url = self.url(self.context, 'refereeform.pdf') 116 121 return 117 122 … … 161 166 def update(self): 162 167 super(CustomApplicantManageFormPage, self).update() 163 upload_formextension = self.request.form.get('form.formextension', None) 164 if upload_formextension: 165 # We got a fresh formextension upload 166 self.upload_success = handle_file_upload( 167 upload_formextension, self.context, self, attr='formextension.pdf') 168 if self.upload_success: 169 self.context.writeLogMessage(self, 'saved: formextension') 168 upload_extraform = self.request.form.get('form.extraform', None) 169 if upload_extraform: 170 # We got a fresh extraform upload 171 success = handle_file_upload( 172 upload_extraform, self.context, self, attr='extraform.pdf') 173 if success: 174 self.context.writeLogMessage(self, 'saved: extraform') 175 else: 176 self.upload_success = False 177 upload_refereeform = self.request.form.get('form.refereeform', None) 178 if upload_refereeform: 179 # We got a fresh refereeform upload 180 success = handle_file_upload( 181 upload_refereeform, self.context, self, attr='refereeform.pdf') 182 if success: 183 self.context.writeLogMessage(self, 'saved: refereeform') 184 else: 185 self.upload_success = False 170 186 self.max_file_upload_size = string_from_bytes(MAX_FILE_UPLOAD_SIZE) 171 187 return … … 195 211 if not store.getFileByContext(self.context, attr=u'passport.jpg'): 196 212 return _('No passport picture uploaded.') 197 if not store.getFileByContext(self.context, attr=u'formextension.pdf'): 198 return _('No form extension pdf file uploaded.') 213 if not store.getFileByContext(self.context, attr=u'extraform.pdf'): 214 return _('No extra information form pdf file uploaded.') 215 if not store.getFileByContext(self.context, attr=u'refereeform.pdf'): 216 return _('No referee form pdf file uploaded.') 199 217 if not self.request.form.get('confirm_passport', False): 200 218 return _('Passport picture confirmation box not ticked.') … … 208 226 return 209 227 super(CustomApplicantEditFormPage, self).update() 210 upload_formextension = self.request.form.get('form.formextension', None) 211 if upload_formextension: 212 # We got a fresh formextension upload 213 self.upload_success = handle_file_upload( 214 upload_formextension, self.context, self, attr='formextension.pdf') 228 upload_extraform = self.request.form.get('form.extraform', None) 229 if upload_extraform: 230 # We got a fresh extraform upload 231 success = handle_file_upload( 232 upload_extraform, self.context, self, attr='extraform.pdf') 233 if not success: 234 self.upload_success = False 235 upload_refereeform = self.request.form.get('form.refereeform', None) 236 if upload_refereeform: 237 # We got a fresh refereeform upload 238 success = handle_file_upload( 239 upload_refereeform, self.context, self, attr='refereeform.pdf') 240 if not success: 241 self.upload_success = False 215 242 self.max_file_upload_size = string_from_bytes(MAX_FILE_UPLOAD_SIZE) 216 243 return 217 244 218 class FormExtension(grok.View):245 class ExtraForm(grok.View): 219 246 """Renders the pdf form extension for applicants. 220 247 """ 221 grok.name(' formextension.pdf')248 grok.name('extraform.pdf') 222 249 grok.context(ICustomApplicant) 223 250 grok.require('waeup.viewApplication') … … 225 252 def render(self): 226 253 pdf = getUtility(IExtFileStore).getFileByContext( 227 self.context, attr=' formextension.pdf')254 self.context, attr='extraform.pdf') 228 255 self.response.setHeader('Content-Type', 'application/pdf') 229 256 return pdf 257 258 class RefereeForm(grok.View): 259 """Renders the pdf referee's form for applicants. 260 """ 261 grok.name('refereeform.pdf') 262 grok.context(ICustomApplicant) 263 grok.require('waeup.viewApplication') 264 265 def render(self): 266 pdf = getUtility(IExtFileStore).getFileByContext( 267 self.context, attr='refereeform.pdf') 268 self.response.setHeader('Content-Type', 'application/pdf') 269 return pdf
Note: See TracChangeset for help on using the changeset viewer.