changeset 13:cd19dc74d179

arnica_slides: fixed definitions of some variables
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 09 Mar 2008 19:08:28 +0100
parents 39ca17464e9c
children 87d11a4031e3
files data/plugin/action/arnica_slides.py
diffstat 1 files changed, 11 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Sun Mar 09 18:50:41 2008 +0100
+++ b/data/plugin/action/arnica_slides.py	Sun Mar 09 19:08:28 2008 +0100
@@ -227,7 +227,7 @@
 
         option_webnail = self.option_list(static_url + target[idx], pagename, target, request)
         static_path, static_url = self.get_path_url(request, pagename, attachment_path)
-
+        
         inner_table_style = ' style="border-style:none; margin:10px;"'
 
         this_webnail_list = ''
@@ -326,20 +326,20 @@
             Page(self.request, self.pagename).send_page()
             return
         # image
-        im = Image.open(file_name)
+        image_object = Image.open(file_name)
         os.remove(file_name)
-        im.rotate(angle).save(file_name, img_type)
+        image_object.rotate(angle).save(file_name, img_type)
 
         # image becomes webnail
-        nim = Image.open(file_name)
-        nim.thumbnail((640, 640), Image.ANTIALIAS)
+        new_image_object = Image.open(file_name)
+        new_image_object.thumbnail((640, 640), Image.ANTIALIAS)
         os.remove(webf)
-        nim.save(webf, img_type)
+        new_image_object.save(webf, img_type)
 
         # image becomes thumbnail based on webnail
-        nim.thumbnail((128, 128), Image.ANTIALIAS)
+        new_image_object.thumbnail((128, 128), Image.ANTIALIAS)
         os.remove(thumbf)
-        nim.save(thumbf, img_type)
+        new_image_object.save(thumbf, img_type)
 
     def render(self):
         """ does execute the commands of the form data """
@@ -374,12 +374,7 @@
             all_exif_date = (all_exif_date[1:])
 
            # XXX Check that all lists have same length
-            z = 0
-            for img in images:
-                if target == img:
-                    idx = z
-                z += 1
-
+            idx = images.index(target)
             attachment_path = AttachFile.getAttachDir(request, pagename)
 
             static_path, static_url = self.get_path_url(request, pagename, attachment_path)
@@ -420,10 +415,8 @@
                 thumbfile = "tmp.thumbnail_%(file)s.jpg"  % {"file": filename}
                 webnail = "tmp.webnail_%(file)s.jpg"  % {"file": filename}
 
-            static_path, static_url = self.get_path_url(request, pagename, attachment_path)
-
-            thumbf = os.path.join(static_path, thumbfile)
-            webf = os.path.join(static_path, webnail)
+            thumbf = os.path.join(attachment_path, thumbfile)
+            webf = os.path.join(attachment_path, webnail)
             infile = os.path.join(attachment_path, target)
 
             msg = None