Changeset 8686 for main/waeup.kofa/trunk/src
- Timestamp:
- 12 Jun 2012, 07:36:23 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/hostels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/container.py
r8685 r8686 20 20 """ 21 21 import grok 22 import pytz 23 from datetime import datetime 22 24 from waeup.kofa.hostels.interfaces import IHostelsContainer, IHostel 23 25 from waeup.kofa.utils.logger import Logger … … 63 65 return self.logger_info(ob_class,target,comment) 64 66 67 @property 68 def expired(self): 69 # Check if application has started ... 70 if not self.startdate or ( 71 self.startdate > datetime.now(pytz.utc)): 72 return True 73 # ... or ended 74 if not self.enddate or ( 75 self.enddate < datetime.now(pytz.utc)): 76 return True 77 return False 78 65 79 HostelsContainer = attrs_to_fields(HostelsContainer) -
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r8685 r8686 22 22 import tempfile 23 23 import grok 24 import pytz 25 from datetime import datetime, timedelta 24 26 from zope.event import notify 25 26 27 from zope.interface.verify import verifyClass, verifyObject 27 28 from zope.component.hooks import setSite, clearSite … … 86 87 self.assertRaises( 87 88 TypeError, hostel.addBed, department) 89 # Application is expired if startdate or enddate are not set 90 # or current datetime is outside application period. 91 self.assertTrue(container.expired) 92 delta = timedelta(days=10) 93 container.startdate = datetime.now(pytz.utc) - delta 94 self.assertTrue(container.expired) 95 container.enddate = datetime.now(pytz.utc) + delta 96 self.assertFalse(container.expired) 88 97 89 98 class HostelsFullSetup(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.