changeset 664:fa2fa5d2b78f

generating formatter module name the same way as the others
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 16 May 2006 21:48:02 +0200
parents 9c65c5b80509
children 498325f3f086 0047a18480c2 1ff03ffb345e a6e0252a3052
files MoinMoin/Page.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue May 16 21:13:31 2006 +0200
+++ b/MoinMoin/Page.py	Tue May 16 21:48:02 2006 +0200
@@ -1007,14 +1007,16 @@
             from MoinMoin.formatter.text_html import Formatter
             self.formatter = Formatter(request, store_pagelinks=1)
         elif not self.formatter:
-            formatterName = self.output_mimetype.replace('/', '_').replace('.', '_') # XXX use existing fn for that
-            try:
-                Formatter = wikiutil.importPlugin(request.cfg, "formatter", formatterName, "Formatter")
-                self.formatter = Formatter(request)
-            except wikiutil.PluginMissingError:
-                from MoinMoin.formatter.text_html import Formatter
-                self.formatter = Formatter(request, store_pagelinks=1)
-                self.output_mimetype = "text/html"
+            omt = wikiutil.MimeType(self.output_mimetype)
+            for module_name in omt.module_name():
+                try:
+                    Formatter = wikiutil.importPlugin(request.cfg, "formatter", module_name, "Formatter")
+                    self.formatter = Formatter(request)
+                    break
+                except wikiutil.PluginMissingError:
+                    pass
+            else:
+                raise "Plugin missing error!" # XXX what now?
         request.formatter = self.formatter
         self.formatter.setPage(self)
         if self.hilite_re: