changeset 659:f72fad57425a

fixed partial page parsers
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 16 May 2006 20:33:17 +0200
parents e9eff264e2b9
children a371c6e972d3
files MoinMoin/formatter/base.py MoinMoin/formatter/text_python.py MoinMoin/parser/text_moin_wiki.py
diffstat 3 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/base.py	Tue May 16 20:14:04 2006 +0200
+++ b/MoinMoin/formatter/base.py	Tue May 16 20:33:17 2006 +0200
@@ -303,7 +303,15 @@
         """ parser_name MUST be valid!
             writes out the result instead of returning it!
         """
-        parser = wikiutil.importPlugin(self.request.cfg, "parser", parser_name, "Parser")
+        mt = wikiutil.MimeType(parser_name)
+        for module_name in mt.module_name():
+            try:
+                parser = wikiutil.importPlugin(self.request.cfg, "parser", module_name, "Parser")
+                break
+            except PluginMissingError:
+                pass
+        else:
+            raise "Parser not found" # XXX what now?
         args = self._get_bang_args(lines[0])
         if args is not None:
             lines = lines[1:]
--- a/MoinMoin/formatter/text_python.py	Tue May 16 20:14:04 2006 +0200
+++ b/MoinMoin/formatter/text_python.py	Tue May 16 20:33:17 2006 +0200
@@ -184,9 +184,14 @@
         """ parser_name MUST be valid!
             prints out the result instead of returning it!
         """
-        try:
-            Dependencies = wikiutil.importPlugin(self.request.cfg, "parser", parser_name, "Dependencies")
-        except wikiutil.PluginAttributeError:
+        mt = wikiutil.MimeType(parser_name)
+        for module_name in mt.module_name():
+            try:
+                Dependencies = wikiutil.importPlugin(self.request.cfg, "parser", module_name, "Dependencies")
+                break
+            except wikiutil.PluginAttributeError:
+                pass
+        else:
             Dependencies = self.defaultDependencies
         if self.__is_static(Dependencies):
             return self.formatter.parser(parser_name, lines)
--- a/MoinMoin/parser/text_moin_wiki.py	Tue May 16 20:14:04 2006 +0200
+++ b/MoinMoin/parser/text_moin_wiki.py	Tue May 16 20:33:17 2006 +0200
@@ -1109,9 +1109,14 @@
     
     def setParser(self, name):
         """ Set parser to parser named 'name' """
-        try:
-            self.parser = wikiutil.importPlugin(self.request.cfg, "parser", name, "Parser")
-        except wikiutil.PluginMissingError:
-            self.parser = None
+        mt = wikiutil.MimeType(name)
+        self.parser = None
+        for module_name in mt.module_name():
+            try:
+                self.parser = wikiutil.importPlugin(self.request.cfg, "parser", module_name, "Parser")
+                break
+            except wikiutil.PluginMissingError:
+                pass
+        else:
+            raise "Parser not found!" # XXX what now?
 
-