diff MoinMoin/action/edit.py @ 1908:8bd4b581cc60

make converter pluggable, dynamically load correct converter, move loading of parser to send_page_content
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 25 Mar 2007 01:34:47 +0100
parents 46e859ee4d2e
children bb2e053067fb
line wrap: on
line diff
--- a/MoinMoin/action/edit.py	Sat Mar 24 22:25:00 2007 +0100
+++ b/MoinMoin/action/edit.py	Sun Mar 25 01:34:47 2007 +0100
@@ -85,10 +85,16 @@
             pg.send_page(msg=msg)
             return
 
-    # convert input from Graphical editor
-    from MoinMoin.converter.text_html_text_moin_wiki import convert, ConvertError
+    from MoinMoin.error import ConvertError
     try:
         if lasteditor == 'gui':
+            # convert input from Graphical editor
+            format = request.form.get('format', ['wiki'])[0]
+            if format == 'wiki':
+                converter_name = 'text_html_text_moin_wiki'
+            else:
+                converter_name = 'undefined' # XXX we don't have other converters yet
+            convert = wikiutil.searchAndImportPlugin(request.cfg, "converter", converter_name)
             savetext = convert(request, pagename, savetext)
 
         # IMPORTANT: normalize text from the form. This should be done in