Ignore:
Timestamp:
4 Jul 2012, 07:52:21 (12 years ago)
Author:
Henrik Bettermann
Message:

Let removeExpired return the number of deleted mandates.

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  
    4141        """Remove all expired mandates.
    4242        """
     43        num_deleted = 0
    4344        for mandate in self.keys():
    4445            if self[mandate].expires < datetime.utcnow():
    4546                del self[mandate]
    46         return
     47                num_deleted += 1
     48        return num_deleted
    4749
    4850class MandatesPlugin(grok.GlobalUtility):
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/interfaces.py

    r8849 r8910  
    3030
    3131    def removeExpired():
    32         """Remove all expired mandates.
     32        """Remove all expired mandates and return the number
     33        of successfully removed mandates.
    3334        """
    3435
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py

    r8860 r8910  
    156156        self.app['mandates'].addMandate(mandate2)
    157157        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)
    159160        # Only the new mandate remains in the container.
    160161        self.assertEqual(len(self.app['mandates'].keys()), 1)
Note: See TracChangeset for help on using the changeset viewer.