Changeset 6816 for main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Timestamp:
- 22 Sep 2011, 12:30:15 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r6724 r6816 25 25 import grok 26 26 27 from datetime import datetime 27 from datetime import datetime, date 28 from zope.authentication.interfaces import ILogout, IAuthentication 29 from zope.component import getUtility 28 30 from zope.formlib.widget import CustomWidgetFactory 29 31 from zope.formlib.form import setUpEditWidgets … … 412 414 pin = self.request.principal.access_code 413 415 414 # Mark pin as used (this also fires a pin related transition) 416 # If application has not yet started, 417 # logout without marking AC as used 418 if self.context.startdate > date.today(): 419 self.flash('Application has not yet started.') 420 auth = getUtility(IAuthentication) 421 ILogout(auth).logout(self.request) 422 self.redirect(self.url(self.context, 'login')) 423 return 424 425 # If application has ended and applicant record doesn't exist, 426 # logout without marking AC as used 427 if not pin in self.context.keys() and self.context.enddate < date.today(): 428 self.flash('Application has ended.') 429 auth = getUtility(IAuthentication) 430 ILogout(auth).logout(self.request) 431 self.redirect(self.url(self.context, 'login')) 432 return 433 434 # Mark AC as used (this also fires a pin related transition) 415 435 if get_access_code(pin).state == USED: 416 436 pass -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser_templates/loginapplicant.pt
r6110 r6816 50 50 </ul> 51 51 </div> 52 < div tal:on-error="nothing">53 <div class="error" tal:content="view/getDeadline">54 The deadline is NOW55 < /div>52 <br /> 53 <div> 54 Start date of application: 55 <span tal:replace="python: context.startdate.strftime('%d/%m/%Y') ">STARTDATE</span> 56 56 </div> 57 <div> 58 Closing date of application: 59 <span tal:replace="python: context.enddate.strftime('%d/%m/%Y')">ENDDATE</span> 60 </div> 61 <br /> 62 <div tal:condition="context/strict_deadline"> 63 No application after deadline! 64 </div> -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r6632 r6816 26 26 import tempfile 27 27 from StringIO import StringIO 28 from datetime import datetime 28 from datetime import datetime, date, timedelta 29 29 from mechanize import LinkNotFoundError 30 30 from zope.component import createObject … … 83 83 applicantscontainer.year = 2009 84 84 applicantscontainer.application_category = 'basic' 85 delta = timedelta(days=10) 86 applicantscontainer.startdate = date.today() - delta 87 applicantscontainer.enddate = date.today() + delta 85 88 self.app['applicants']['app2009'] = applicantscontainer 86 89 … … 350 353 appl = appl[pin] 351 354 passp = appl.passport 352 #import pdb; pdb.set_trace()353 355 passp_len = len(passp.file.read()) 354 356 self.assertEqual(passp_len, PH_LEN) … … 456 458 applicantscontainer = ApplicantsContainer() 457 459 applicantscontainer.ac_prefix = 'APP' 460 delta = timedelta(days=10) 461 applicantscontainer.startdate = date.today() - delta 462 applicantscontainer.enddate = date.today() + delta 458 463 app['applicants']['testapplicants'] = applicantscontainer 459 464 … … 629 634 def test_after_login_default_browsable(self): 630 635 # After login we see the placeholder image in the edit view 636 #import pdb; pdb.set_trace() 631 637 self.login() 632 638 self.assertEqual(self.browser.url, self.edit_path)
Note: See TracChangeset for help on using the changeset viewer.