changeset 171:6c5af220a85a

action.refresh: refactored for using of cache.remove
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 14 Jul 2008 19:36:57 +0200
parents a489fd432404
children a2c26bbd9ed8
files data/plugin/action/refresh.py
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/refresh.py	Mon Jul 14 19:15:35 2008 +0200
+++ b/data/plugin/action/refresh.py	Mon Jul 14 19:36:57 2008 +0200
@@ -9,6 +9,7 @@
 """
 import os
 from MoinMoin import config
+from MoinMoin.action import cache
 from MoinMoin.Page import Page
 
 def execute(pagename, request):
@@ -25,11 +26,13 @@
     caching.CacheEntry(request, arena, "pagelinks", scope='item').remove()
 
     # remove cache files from arnica 
-    page = Page(request, pagename)
-    path = caching.get_arena_dir(request, page, 'item')
-    files = [fn.decode(config.charset) for fn in os.listdir(path)]
-    for key in files:
-        if key.startswith('tmp.'):
-            caching.CacheEntry(request, page, key, scope='item').remove()
+    path = caching.CacheEntry(request, cache.cache_arena, "", 
+                              cache.cache_scope, do_locking=False)._filename()
+    
+    files = [fn.decode(config.charset) for fn in os.listdir(path)  if fn.endswith('data')]
+    for file_name in files:
+        key, ext = os.path.splitext(file_name)
+        if key.startswith('T') or key.startswith('W'):
+            cache.remove(request, key)
 
     request.page.send_page()