changeset 5065:bb1df7737cf2

formatter.text_gedit: calls attachment_drawing from the dependent drawing action
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 30 Aug 2009 23:26:25 +0200
parents 04273434be4a
children 1008a0fca6a5
files MoinMoin/formatter/text_gedit.py
diffstat 1 files changed, 8 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/text_gedit.py	Sun Aug 30 22:42:32 2009 +0200
+++ b/MoinMoin/formatter/text_gedit.py	Sun Aug 30 23:26:25 2009 +0200
@@ -93,20 +93,14 @@
         return self.image(**kw)
 
     def attachment_drawing(self, url, text, **kw):
-        _ = self.request.getText
-        # TODO: this 'text' argument is kind of superfluous, replace by using alt=... kw arg
-        if 'alt' not in kw or not kw['alt']:
-            kw['alt'] = text
-        # we force the title here, needed later for html>wiki converter
-        kw['title'] = "drawing:%s" % wikiutil.quoteWikinameURL(url)
-        pagename = self.page.page_name
-        if '/' in url:
-            pagename, target = AttachFile.absoluteName(url, pagename)
-            url = url.split('/')[-1]
-        url += '.png'
-        kw['src'] = AttachFile.getAttachUrl(pagename, url, self.request, addts=1)
-        return self.image(**kw)
-
+        # Todo get it to start the drawing editor on a click
+        try:
+            attachment_drawing = wikiutil.importPlugin(self.request.cfg, 'action',
+                                              self.request.cfg.drawing_action, 'attachment_drawing')
+            return attachment_drawing(self, url, text, **kw)
+        except (wikiutil.PluginMissingError, wikiutil.PluginAttributeError):
+            return url
+        
     def icon(self, type):
         return self.request.theme.make_icon(type, title='smiley:%s' % type)