Changeset 8910
- Timestamp:
- 4 Jul 2012, 07:52:21 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/mandates
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/mandates/container.py
r8846 r8910 41 41 """Remove all expired mandates. 42 42 """ 43 num_deleted = 0 43 44 for mandate in self.keys(): 44 45 if self[mandate].expires < datetime.utcnow(): 45 46 del self[mandate] 46 return 47 num_deleted += 1 48 return num_deleted 47 49 48 50 class MandatesPlugin(grok.GlobalUtility): -
main/waeup.kofa/trunk/src/waeup/kofa/mandates/interfaces.py
r8849 r8910 30 30 31 31 def removeExpired(): 32 """Remove all expired mandates. 32 """Remove all expired mandates and return the number 33 of successfully removed mandates. 33 34 """ 34 35 -
main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py
r8860 r8910 156 156 self.app['mandates'].addMandate(mandate2) 157 157 self.assertEqual(len(self.app['mandates'].keys()), 2) 158 self.app['mandates'].removeExpired() 158 num_deleted = self.app['mandates'].removeExpired() 159 self.assertEqual(num_deleted, 1) 159 160 # Only the new mandate remains in the container. 160 161 self.assertEqual(len(self.app['mandates'].keys()), 1)
Note: See TracChangeset for help on using the changeset viewer.