Changeset 8665 for main/waeup.kofa/trunk/src
- Timestamp:
- 10 Jun 2012, 08:59:49 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py
r8664 r8665 19 19 """ 20 20 import os 21 import pytz22 21 import sys 23 22 import grok … … 914 913 915 914 def update(self): 916 if self.context.locked: 915 if self.context.locked or ( 916 self.context.__parent__.expired and 917 self.context.__parent__.strict_deadline): 917 918 self.emit_lock_message() 918 919 return … … 963 964 if state != PAID: 964 965 self.flash(_('The form cannot be submitted. Wrong state!')) 965 return966 cond1 = self.context.__parent__.strict_deadline967 cond2 = self.context.__parent__.enddate968 cond3 = self.context.__parent__.enddate < datetime.now(pytz.utc)969 if cond1 and (not cond2 or cond3):970 self.flash(971 _('The form cannot be submitted. Application period has expired!'))972 966 return 973 967 IWorkflowInfo(self.context).fireTransition('submit') … … 1023 1017 1024 1018 def update(self): 1025 # Check if application has started ... 1026 if not self.context.startdate or ( 1027 self.context.startdate > datetime.now(pytz.utc)): 1028 self.flash(_('Application has not yet started.')) 1029 self.redirect(self.url(self.context)) 1030 return 1031 # ... or ended 1032 if not self.context.enddate or ( 1033 self.context.enddate < datetime.now(pytz.utc)): 1034 self.flash(_('Application has ended.')) 1019 if self.context.expired: 1020 self.flash(_('Outside application period.')) 1035 1021 self.redirect(self.url(self.context)) 1036 1022 return -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/container.py
r8645 r8665 21 21 from random import SystemRandom as r 22 22 import grok 23 import pytz 24 from datetime import datetime 23 25 from zope.component import getUtility 24 26 from zope.component.factory import Factory … … 101 103 return getUtility(IApplicantsUtils).getApplicantsStatistics(self) 102 104 105 @property 106 def expired(self): 107 # Check if application has started ... 108 if not self.startdate or ( 109 self.startdate > datetime.now(pytz.utc)): 110 return True 111 # ... or ended 112 if not self.enddate or ( 113 self.enddate < datetime.now(pytz.utc)): 114 return True 115 return False 116 117 103 118 ApplicantsContainer = attrs_to_fields(ApplicantsContainer) 104 119 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
r8664 r8665 773 773 self.assertTrue('Final Submit' in self.browser.contents) 774 774 self.fill_correct_values() # fill other fields with correct values 775 self.browser.getControl("Save").click() 775 776 self.browser.getControl("Final Submit").click() 776 777 # We forgot to upload a passport picture … … 789 790 in self.browser.contents) 790 791 self.browser.getControl(name="confirm_passport").value = True 792 # If application period has expired and strict-deadline is set 793 # applicants do notsee edit button and can't open 794 # the edit form. 791 795 self.applicantscontainer.enddate = datetime.now(pytz.utc) 792 self.browser.getControl("Final Submit").click() 793 self.assertTrue( 794 'Application period has expired' in self.browser.contents) 796 self.browser.open(self.view_path) 797 self.assertFalse( 798 'Edit application record' in self.browser.contents) 799 self.browser.open(self.edit_path) 800 self.assertTrue( 801 'form is locked' in self.browser.contents) 795 802 # We can either postpone the enddate ... 796 803 self.applicantscontainer.enddate = datetime.now( 797 804 pytz.utc) + timedelta(days=10) 805 self.browser.open(self.edit_path) 798 806 self.browser.getControl(name="confirm_passport").value = True 799 807 self.browser.getControl("Final Submit").click() … … 811 819 self.browser.goBack(count=1) 812 820 self.browser.getControl("Save").click() 821 # The form is locked. 813 822 self.assertTrue( 814 823 'The requested form is locked' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/viewlets.py
r8565 r8665 157 157 """Get a URL to the target... 158 158 """ 159 if self.context.locked: 159 if self.context.locked or ( 160 self.context.__parent__.expired and 161 self.context.__parent__.strict_deadline): 160 162 return 161 163 return self.view.url(self.view.context, self.target)
Note: See TracChangeset for help on using the changeset viewer.