changeset 215:63bb59fda932

arnica_slides: moving to bak file by AttachFile.move_file
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 01 Sep 2008 17:07:28 +0200
parents e7bf7e714d13
children 0779bac0e8f4
files data/plugin/action/arnica_slides.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/arnica_slides.py	Mon Sep 01 10:10:28 2008 +0200
+++ b/data/plugin/action/arnica_slides.py	Mon Sep 01 17:07:28 2008 +0200
@@ -433,12 +433,12 @@
             # ToDo simplify
             if ext in ('.gif', '.png'):
                 img_type = 'PNG'
-                thumbfile = "tmp.thumbnail_%(file)s.png" % {"file": filename}
-                webnail = "tmp.webnail_%(file)s.png" % {"file": filename}
+                thumbfile = "tmp.thumbnail_%s.png" % filename
+                webnail = "tmp.webnail_%s.png" % filename
             else:
                 img_type = "JPEG"
-                thumbfile = "tmp.thumbnail_%(file)s.jpg"  % {"file": filename}
-                webnail = "tmp.webnail_%(file)s.jpg"  % {"file": filename}
+                thumbfile = "tmp.thumbnail_%s.jpg"  % filename
+                webnail = "tmp.webnail_%s.jpg"  % filename
 
             if command in ('delete', 'rotate_left', 'rotate_right', ):
                 cache.remove(self.request, webnail)
@@ -447,11 +447,13 @@
             infile = AttachFile.getFilename(request, pagename, target)
 
             # removes attachment (moves to bak)
-            # ToDo simplify call AttachFile.move_attachment
             if command == 'delete':
-                if os.path.exists(infile + '.bak'):
+                bakfile = "%s.bak" % target
+                try:
                     os.unlink("%(file)s.bak" % {"file": infile})
-                filesys.rename(infile, "%(file)s.bak" % {"file": infile})
+                except:
+                    pass
+                AttachFile.move_file(request, pagename, pagename, target, bakfile)
                 msg = _('%(target)s deleted, backup in place') % {'target': target}
 
             # rotate left