diff MoinMoin/formatter/text_html.py @ 5102:9ae242080889

drawings/attachments: made editing support more generic (details see below) refactored AttachFile.getAttachUrl: * removed drawing param * it detects drawings now from the filename's extension (e.g. .adraw for the anywikidraw container and .tdraw for the twikidraw container) * it returns None now, if the combination of filename (extension) and do=something is not supported AttachFile.get_action looks up the action (module name) for specific combinations of filenames (extension) and do=subaction. info/history and AttachFile filelist action: Less hardcoded drawing support, it now just tries to get a do=modify URL for every file attachment. If that works, there will be an edit link for that attachment. action.anywikidraw and action.twikidraw: * they get the full container filename now and also use them in UI * they call do=modify to invoke the drawing applet multiconfig: removed drawing_action text_moin_wiki parser: use wikiutil.drawing2fname to process the given drawing name. if it looks like fully qualified (e.g. foo.tdraw, foo.adraw, foo.svg, foo.png, ...), then keep it. otherwise (e.g. foo, foo.bar, ...) append .tdraw as default drawing filename extension to be backwards compatible.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 13 Sep 2009 16:01:09 +0200
parents ff588e9e24d6
children 12d27670e274
line wrap: on
line diff
--- a/MoinMoin/formatter/text_html.py	Sun Sep 13 02:44:37 2009 +0200
+++ b/MoinMoin/formatter/text_html.py	Sun Sep 13 16:01:09 2009 +0200
@@ -655,10 +655,12 @@
     def attachment_drawing(self, url, text, **kw):
         # ToDo try to move this to a better place e.g. __init__
         try:
+            drawing_action = AttachFile.get_action(self.request, url, do='modify')
+            assert drawing_action is not None
             attachment_drawing = wikiutil.importPlugin(self.request.cfg, 'action',
-                                              self.request.cfg.drawing_action, 'attachment_drawing')
+                                              drawing_action, 'attachment_drawing')
             return attachment_drawing(self, url, text, **kw)
-        except (wikiutil.PluginMissingError, wikiutil.PluginAttributeError):
+        except (wikiutil.PluginMissingError, wikiutil.PluginAttributeError, AssertionError):
             return url
 
     # Text ##############################################################