[Zope-Checkins] CVS: Products/StandardCacheManagers - RAMCacheManager.py:1.10.68.3

Jens Vagelpohl jens at dataflake.org
Mon Nov 8 04:50:29 EST 2004


Update of /cvs-repository/Products/StandardCacheManagers
In directory cvs.zope.org:/tmp/cvs-serv19146/lib/python/Products/StandardCacheManagers

Modified Files:
      Tag: Zope-2_7-branch
	RAMCacheManager.py 
Log Message:
- RAMCacheManager: Allow invalidation of a cache entry from the
  Statistics view in the ZMI


=== Products/StandardCacheManagers/RAMCacheManager.py 1.10.68.2 => 1.10.68.3 ===
--- Products/StandardCacheManagers/RAMCacheManager.py:1.10.68.2	Thu Apr 29 16:08:00 2004
+++ Products/StandardCacheManagers/RAMCacheManager.py	Mon Nov  8 04:49:59 2004
@@ -346,7 +346,7 @@
                                      'manage_stats',
                                      'getCacheReport',
                                      'sort_link',)),
-        ('Change cache managers', ('manage_editProps',), ('Manager',)),
+        ('Change cache managers', ('manage_editProps','manage_invalidate'), ('Manager',)),
         )
 
     manage_options = (
@@ -450,6 +450,20 @@
             newsr = not sort_reverse
         url = url + '&sort_reverse=' + (newsr and '1' or '0')
         return '<a href="%s">%s</a>' % (escape(url, 1), escape(name))
+
+    def manage_invalidate(self, paths, REQUEST=None):
+        """ ZMI helper to invalidate an entry """
+        for path in paths:
+            try:
+                ob = self.unrestrictedTraverse(path)
+            except (AttributeError, KeyError):
+                pass
+
+            ob.ZCacheable_invalidate()
+
+        if REQUEST is not None:
+            msg = 'Cache entries invalidated'
+            return self.manage_stats(manage_tabs_message=msg)
 
 Globals.default__class_init__(RAMCacheManager)
 



More information about the Zope-Checkins mailing list