changeset 1734:db207703e114

text_gedit: fixed displaying images from other pages as current for attachment_image and ImageLink
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 13 Jan 2007 20:28:27 +0100
parents d97b403ff6b9
children 5e870f4e5d2e
files MoinMoin/formatter/text_gedit.py
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/text_gedit.py	Tue Jan 09 22:14:26 2007 +0100
+++ b/MoinMoin/formatter/text_gedit.py	Sat Jan 13 20:28:27 2007 +0100
@@ -73,9 +73,14 @@
     def attachment_image(self, url, **kw):
         _ = self.request.getText
         pagename = self.page.page_name
-        return self.image(
-            title="attachment:%s" % wikiutil.quoteWikinameURL(url),
-            src=AttachFile.getAttachUrl(pagename, url, self.request, addts=1))
+        kw = {}
+        kw['title'] = "attachment:%s" % wikiutil.quoteWikinameURL(url)
+        if '/' in url:
+            pagename, target = AttachFile.absoluteName(url, pagename)
+            url = url.split('/')
+            url = url[len(url)-1]
+        kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
+        return self.image(**kw)
 
     def attachment_drawing(self, url, text, **kw):
         _ = self.request.getText
@@ -124,6 +129,10 @@
                         kw['target'] = arg
                     pos += 1
             if not kw['src']:
+                if '/' in url:
+                    pagename, target = AttachFile.absoluteName(url, pagename)
+                    url = url.split('/')
+                    url = url[len(url)-1]
                 kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
             return self.image(**kw)