changeset 185:7e23f320ce08

arnica: improve/reorganize some code
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 17 Jul 2008 23:28:47 +0200
parents b19e4e36a1f2
children a2a5dedfeb1d
files data/plugin/action/arnica_slides.py data/plugin/parser/text_x_arnica.py
diffstat 2 files changed, 10 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Thu Jul 17 23:02:03 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Thu Jul 17 23:28:47 2008 +0200
@@ -406,11 +406,9 @@
         request = self.request
         pagename = request.form.get('pagename', [self.pagename])[0]
         page = Page(request, pagename)
-        arena_dir = caching.get_arena_dir(request, page, 'item')
         msg = None
 
         request.formatter = Formatter(request)
-        attachment_path = AttachFile.getAttachDir(request, pagename)
         command = request.form.get('do', ['none'])[0]
         target = request.form.get('target', [''])[0]
 
@@ -419,7 +417,8 @@
             self.slide_show(pagename)
         # view sends a cached attachment (thumbnail or webnail) to the browser
         elif command == 'view':
-            send_cache_file(request, pagename, arena_dir, target)
+            arena_dir = caching.get_arena_dir(request, page, 'item')
+            send_cache_file(request, pagename, arena_dir, target) # XXX function missing!
 
         # only users which are allowed to delete should use this tool
         elif request.user.may.delete(pagename):
@@ -441,14 +440,13 @@
                 thumbfile = "tmp.thumbnail_%(file)s.jpg"  % {"file": filename}
                 webnail = "tmp.webnail_%(file)s.jpg"  % {"file": filename}
 
-            cache_web = caching.CacheEntry(request, page, webnail, scope='item', use_pickle=True)
-            cache_thumb = caching.CacheEntry(request, page, thumbfile, scope='item', use_pickle=True)
-            infile = os.path.join(attachment_path, target)
+            if command in ('delete', 'rotate_left', 'rotate_right', ):
+                cache_web = caching.CacheEntry(request, page, webnail, scope='item', use_pickle=True)
+                cache_web.remove()
+                cache_thumb = caching.CacheEntry(request, page, thumbfile, scope='item', use_pickle=True)
+                cache_thumb.remove()
 
-            if command in ('delete', 'rotate_left', 'rotate_right', ):
-                # removes cache files
-                cache_web.remove()
-                cache_thumb.remove()
+            infile = AttachFile.getFilename(request, pagename, target)
 
             # removes attachment (moves to bak)
             if command == 'delete':
--- a/data/plugin/parser/text_x_arnica.py	Thu Jul 17 23:02:03 2008 +0200
+++ b/data/plugin/parser/text_x_arnica.py	Thu Jul 17 23:28:47 2008 +0200
@@ -517,11 +517,11 @@
         page = Page(self.request, self.pagename)
 
         cache_web = caching.CacheEntry(self.request, cache.cache_arena, webnail+'.data',
-                                        cache.cache_scope, do_locking=False)
+                                       cache.cache_scope, do_locking=False)
         webnail_image_filename = cache_web._filename()
 
         cache_thumb = caching.CacheEntry(self.request, cache.cache_arena, thumbnail+'.data',
-                                        cache.cache_scope, do_locking=False)
+                                         cache.cache_scope, do_locking=False)
         thumbnail_image_filename = cache_thumb._filename()
 
         if self.renew: