changeset 166:9817520ac155

text_x_arnica, arnica_slides: refactored sendcached.* to cache.* methods
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 14 Jul 2008 17:15:39 +0200
parents 7332323c8a6f
children 3311d9f639cf
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 17 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Mon Jul 14 16:21:48 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Mon Jul 14 17:15:39 2008 +0200
@@ -15,7 +15,7 @@
 
 from MoinMoin import  caching, config, wikiutil
 from MoinMoin.Page import Page
-from MoinMoin.action import ActionBase, AttachFile, sendcached
+from MoinMoin.action import ActionBase, AttachFile, cache
 from MoinMoin.formatter.text_html import Formatter
 from MoinMoin.packages import packLine, unpackLine
 from MoinMoin.util import filesys, timefuncs
@@ -177,7 +177,7 @@
     @param image_for_webnail: identifier for AttchFile or arnica_slides
     """
     if not image_for_webnail:
-        url = sendcached.get_url(request, "")
+        url = cache.url(request, "")
     else:
         url = AttachFile.getAttachUrl(pagename, "", request)
 
@@ -241,11 +241,12 @@
     @param text: array of filenames
     @param request: request object
     """
+    # ToDo original image needs to be send to the action and used instead of the alias
     txt = ''
     i = 0
     for filename in text:
         if not image_for_webnail:
-            url = sendcached.get_url(request, filename)
+            url = cache.url(request, filename)
             prefix = 'Webnail'
         else:
             url = AttachFile.getAttachUrl(pagename, filename, request)
@@ -338,7 +339,7 @@
 
         web = {}
         if not image_for_webnail:
-            web['src'] = sendcached.get_url(request, target)
+            web['src'] = cache.url(request, target)
         else:
             web['src']  = AttachFile.getAttachUrl(pagename, target, request)
 
--- a/data/plugin/parser/text_x_arnica.py	Mon Jul 14 16:21:48 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Mon Jul 14 17:15:39 2008 +0200
@@ -18,7 +18,7 @@
 from random import randint
 
 from MoinMoin import caching, config, wikiutil
-from MoinMoin.action import AttachFile, sendcached
+from MoinMoin.action import AttachFile, cache
 from MoinMoin.filter import EXIF
 from MoinMoin.packages import packLine
 from MoinMoin.Page import Page
@@ -365,7 +365,7 @@
      "image_for_webnail": self.image_for_webnail,
      "target": self.webimg[idx],
      "images": packLine([self.webimg[idx]] + self.webimg),
-     "thumbnail": sendcached.get_url(self.request, self.thumb[idx]),
+     "thumbnail": cache.url(self.request, self.thumb[idx]),
      "thumbnail_width": self.thumbnail_width,
      "html_tools": self.html_show_tools(idx),
      "date_html": self.html_show_date(idx),
@@ -393,15 +393,15 @@
             if ext in ('.gif', '.png'):
                 self.imgtype.append('PNG')
                 file_name = 'tmp.webnail_%s.png' % fname
-                webnail = sendcached.cache_key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'W'
+                webnail = cache.key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'W'
                 file_name = 'tmp.thumbnail_%s.png' % fname
-                thumbfile = sendcached.cache_key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'T'
+                thumbfile = cache.key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'T'
             else:
                 self.imgtype.append("JPEG")
                 file_name = 'tmp.webnail_%s.jpg' % fname
-                webnail = sendcached.cache_key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'W'
+                webnail = cache.key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'W'
                 file_name = 'tmp.thumbnail_%s.jpg' % fname
-                thumbfile = sendcached.cache_key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'T'
+                thumbfile = cache.key(self.request, itemname=self.pagename, attachname=attfile, secret=secret) + 'T'
 
             att_file = os.path.join(path, attfile)
             if os.path.exists(att_file):
@@ -506,12 +506,12 @@
 
         page = Page(self.request, self.pagename)
 
-        cache_web = caching.CacheEntry(self.request, sendcached.sendcached_arena, webnail+'.data',
-                                        sendcached.sendcached_scope, do_locking=False)
+        cache_web = caching.CacheEntry(self.request, cache.cache_arena, webnail+'.data',
+                                        cache.cache_scope, do_locking=False)
         webf = cache_web._filename()
         
-        cache_thumb = caching.CacheEntry(self.request, sendcached.sendcached_arena, thumbnail+'.data',
-                                        sendcached.sendcached_scope, do_locking=False)
+        cache_thumb = caching.CacheEntry(self.request, cache.cache_arena, thumbnail+'.data',
+                                        cache.cache_scope, do_locking=False)
         thumbf = cache_thumb._filename()
         
         if self.renew:
@@ -533,7 +533,7 @@
                     # ToDo find a way to add the im_obj data immediately to the cache arena
                     im_obj.save(webf, image_type)
                     st = os.stat(webf)
-                    sendcached.put_cache(self.request, webnail, 'dummy', filename=image, content_length=st.st_size)
+                    cache.put(self.request, webnail, 'dummy', filename=image, content_length=st.st_size)
                     im_obj.save(webf, image_type)
 
             if not cache_thumb.exists():
@@ -541,7 +541,7 @@
                 # ToDo find a way to add the im_obj data immediately to the cache arena
                 im_obj.save(thumbf, image_type)
                 st = os.stat(thumbf)
-                sendcached.put_cache(self.request, thumbnail, 'dummy', filename=image, content_length=st.st_size)
+                cache.put(self.request, thumbnail, 'dummy', filename=image, content_length=st.st_size)
                 im_obj.save(thumbf, image_type)
 
     def render(self, formatter):