[Zope-CVS] CVS: Products/Transience - Transience.py:1.10

Matthew T. Kromer matt@zope.com
Wed, 7 Nov 2001 15:13:16 -0500


Update of /cvs-repository/Products/Transience
In directory cvs.zope.org:/tmp/cvs-serv7357

Modified Files:
	Transience.py 
Log Message:
Modify reset to call delete notification on all entries if _ring exists.


=== Products/Transience/Transience.py 1.9 => 1.10 ===
         # We should assert that the callback function 'f' implements
         # the TransientNotification interface
+        print "setting addNotificationTarget to %s" % f
         self._addCallback = f             
 
     security.declareProtected(MGMT_SCREEN_PERM, 'getDelNotificationTarget')
@@ -278,6 +279,7 @@
     def setDelNotificationTarget(self, f):
         # We should assert that the callback function 'f' implements
         # the TransientNotification interface
+        print "setting delNotificationTarget to %s" % f
         self._delCallback = f
 
 
@@ -369,6 +371,12 @@
         self._timeout_secs = timeout_mins * 60
 
     def _reset(self):
+
+        if hasattr(self,'_ring'):
+            for k in self.keys():
+                self.notifyDestruct(self[k])
+                del self[k]
+        
         t_secs = self._timeout_secs
         r_secs = self._resolution_secs = int(t_secs * self._err_margin) or 1
         numbuckets = int(math.floor(t_secs/r_secs)) or 1