changeset 6:756cb845ddad

removed var self.static_path
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 08 Mar 2008 21:46:11 +0100
parents 413a64b78621
children a067ae7020f6
files data/plugin/parser/text_x_arnica.py
diffstat 1 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/parser/text_x_arnica.py	Sat Mar 08 21:18:36 2008 +0100
+++ b/data/plugin/parser/text_x_arnica.py	Sat Mar 08 21:46:11 2008 +0100
@@ -112,7 +112,7 @@
         self.thumbnail_width = '128'
         self.webnail_width = '640'
         self.text_width = '140'
-        self.form = None
+        
 
         test = kw.get('format_args', '')
         if test:
@@ -131,7 +131,10 @@
         self.outer_table_style = ' border="%s"' % self.border_thick
         self.inner_table_style = ' style="border-style:none; margin:10px;"'
         self.td_style = ' align="center" style="padding:0; margin:2px 2px; border-style:none"'
-
+        
+        self.form = None
+        self.pagename = request.page.page_name
+        
     def show_tools_restricted(self, this_target):
         """ show only tools to users with enough rights 
         @param this_target: image
@@ -459,12 +462,13 @@
         
     def select_files(self, formatter):
         """ select files """
+        
+        # we need to take the page_name from the formatter.page otherwise include does not work
         self.pagename = formatter.page.page_name
         if self.target_page:
             self.pagename = self.target_page
-        
+        path = AttachFile.getAttachDir(self.request, self.pagename, create=1)
         self.quoted_pagename = wikiutil.quoteWikinameURL(self.pagename)
-        self.static_path = AttachFile.getAttachDir(self.request, self.pagename, create=1)
 
         self.static_url = AttachFile.getAttachUrl(self.pagename, '', self.request)
         Image_Dict = {}
@@ -474,7 +478,7 @@
             all_files = quotes['image']
             result = []
             for attfile in all_files:
-                if os.path.exists(os.path.join(self.static_path, attfile)):
+                if os.path.exists(os.path.join(path, attfile)):
                     result.append(attfile)
             all_files = result
 
@@ -484,7 +488,7 @@
 
                 i = 0
                 for attfile in all_files:
-                    infile = os.path.join(self.static_path, attfile)
+                    infile = os.path.join(path, attfile)
                     Image_Dict[alias_text[i]] = attfile
                     i += 1
 
@@ -494,7 +498,7 @@
                     result.append(Image_Dict[txt])
                 all_files = result
         else:
-            all_files = os.listdir(self.static_path)
+            all_files = os.listdir(path)
         
         if self.filter != '.':
             result = []
@@ -508,7 +512,7 @@
 
         if self.sort_by_date == '1':
             for attfile in all_files:
-                infile = os.path.join(self.static_path, attfile)
+                infile = os.path.join(path, attfile)
                 ft_file = "%s%s" % (str(os.path.getmtime(infile)), str(randint(0, 65535)))
                 Image_Dict[ft_file] = attfile   
             keys = Image_Dict.keys()
@@ -524,7 +528,7 @@
             all_files.reverse()
 
         if all_files:
-            self.get_files(self.static_path, all_files, quotes)        
+            self.get_files(path, all_files, quotes)        
         
         return all_files
     
@@ -535,9 +539,10 @@
         @param thumbnail: filename of thumbnail file
         @param image_type: filetype of image
         """
-        imagef = os.path.join(self.static_path, image)
-        webf = os.path.join(self.static_path, webnail)
-        thumbf = os.path.join(self.static_path, thumbnail) 
+        path = AttachFile.getAttachDir(self.request, self.pagename, create=1)
+        imagef = os.path.join(path, image)
+        webf = os.path.join(path, webnail)
+        thumbf = os.path.join(path, thumbnail) 
         
         if self.renew == '1':
             if os.path.exists(thumbf):