changeset 524:1414a0d200ec

macro.Image: bug fix testing for existing file must be done for AttachFile.absoluteName
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 23 Apr 2010 23:31:42 +0200
parents fe7e720bd778
children 766d8ba45f84
files data/plugin/macro/Image.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/Image.py	Fri Apr 23 22:38:00 2010 +0200
+++ b/data/plugin/macro/Image.py	Fri Apr 23 23:31:42 2010 +0200
@@ -250,10 +250,11 @@
         <<Image(PageName/attachname,width=100,alt="sample image")>>
     """
     _ = macro.request.getText
-    if not AttachFile.exists(macro.request, macro.formatter.page.page_name, itemname):
-        return _("Attachment '%(filename)s' does not exist!") % {"filename": itemname}
-    if '/' not in itemname:
-        itemname = macro.formatter.page.page_name + '/' + itemname
+    current_pagename = macro.formatter.page.page_name
+    page_name, filename = AttachFile.absoluteName(itemname, current_pagename)
+    if not AttachFile.exists(macro.request, page_name, filename):
+        return _("Attachment '%(filename)s' does not exist!") % {"filename": itemname}                                                                     
+    itemname = page_name + '/' + filename
     img = Image(macro.request, itemname, caption=alt)
 
     div_width = ""