- Timestamp:
- 9 Sep 2015, 13:06:31 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r13249 r13254 39 39 from waeup.kofa.applicants.applicant import search 40 40 from waeup.kofa.applicants.workflow import ( 41 INITIALIZED, STARTED, PAID, SUBMITTED, ADMITTED )41 INITIALIZED, STARTED, PAID, SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED) 42 42 from waeup.kofa.browser import ( 43 43 # KofaPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage, … … 1300 1300 return 1301 1301 1302 class ApplicantCheckStatusPage(KofaPage): 1303 """Captcha'd status checking page for applicants. 1304 """ 1305 grok.context(IApplicantsRoot) 1306 grok.name('checkstatus') 1307 grok.require('waeup.Anonymous') 1308 grok.template('applicantcheckstatus') 1309 buttonname = _('Submit') 1310 1311 def label(self): 1312 if self.result: 1313 return _('Application status of ${a}', 1314 mapping = {'a':self.applicant.applicant_id}) 1315 return _('Check your application status') 1316 1317 def update(self, SUBMIT=None): 1318 form = self.request.form 1319 self.result = False 1320 # Handle captcha 1321 self.captcha = getUtility(ICaptchaManager).getCaptcha() 1322 self.captcha_result = self.captcha.verify(self.request) 1323 self.captcha_code = self.captcha.display(self.captcha_result.error_code) 1324 if SUBMIT: 1325 if not self.captcha_result.is_valid: 1326 # Captcha will display error messages automatically. 1327 # No need to flash something. 1328 return 1329 applicant_id = form.get('applicant_id', None) 1330 lastname = form.get('lastname', None) 1331 if not applicant_id or not lastname: 1332 self.flash( 1333 _('Required input missing.'), type='warning') 1334 return 1335 cat = getUtility(ICatalog, name='applicants_catalog') 1336 results = list( 1337 cat.searchResults(applicant_id=(applicant_id, applicant_id))) 1338 if results: 1339 applicant = results[0] 1340 if applicant.lastname.lower() != lastname.lower(): 1341 # Don't tell the truth here. Anonymous must not 1342 # know that a record was found and only the lastname 1343 # verification failed. 1344 self.flash( 1345 _('No application record found.'), type='warning') 1346 return 1347 else: 1348 self.flash(_('No application record found.'), type='warning') 1349 return 1350 self.applicant = applicant 1351 self.entry_session = "%s/%s" % ( 1352 applicant.__parent__.year, 1353 applicant.__parent__.year+1) 1354 course_admitted = getattr(applicant, 'course_admitted', None) 1355 self.course_admitted = False 1356 if course_admitted is not None: 1357 self.course_admitted = True 1358 self.longtitle = course_admitted.longtitle 1359 self.department = course_admitted.__parent__.__parent__.longtitle 1360 self.faculty = course_admitted.__parent__.__parent__.__parent__.longtitle 1361 self.result = True 1362 self.admitted = False 1363 self.not_admitted = False 1364 self.submitted = False 1365 self.not_submitted = False 1366 if applicant.state in (ADMITTED, CREATED): 1367 self.admitted = True 1368 if applicant.state in (NOT_ADMITTED,): 1369 self.not_admitted = True 1370 if applicant.state in (SUBMITTED,): 1371 self.submitted = True 1372 if applicant.state in (INITIALIZED, STARTED, PAID): 1373 self.not_submitted = True 1374 return 1375 1302 1376 class ExportJobContainerOverview(KofaPage): 1303 1377 """Page that lists active applicant data export jobs and provides links
Note: See TracChangeset for help on using the changeset viewer.