changeset 1531:b369a5c3f3e2

Restore the formatter in send_page, fixes 'empty' search results.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Tue, 05 Sep 2006 02:39:58 +0200
parents bc85c370d21a
children 5e7dd6dd485a
files MoinMoin/Page.py docs/CHANGES
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Tue Sep 05 02:38:37 2006 +0200
+++ b/MoinMoin/Page.py	Tue Sep 05 02:39:58 2006 +0200
@@ -1054,7 +1054,12 @@
         elif not self.formatter:
             Formatter = wikiutil.searchAndImportPlugin(request.cfg, "formatter", self.output_mimetype)
             self.formatter = Formatter(request)
+
+        # save formatter
+        no_formatter = object()
+        old_formatter = getattr(request, "formatter", no_formatter)
         request.formatter = self.formatter
+
         self.formatter.setPage(self)
         if self.hilite_re:
             self.formatter.set_highlight_re(self.hilite_re)
@@ -1305,6 +1310,14 @@
         if not content_only and self.default_formatter:
             request.theme.send_closing_html()
 
+        # restore old formatter (hopefully we dont throw any exception
+        # that is catched again)
+        if old_formatter == no_formatter:
+            del request.formatter
+        else:
+            request.formatter = old_formatter
+
+
     def getFormatterName(self):
         """ Return a formatter name as used in the caching system
 
--- a/docs/CHANGES	Tue Sep 05 02:38:37 2006 +0200
+++ b/docs/CHANGES	Tue Sep 05 02:39:58 2006 +0200
@@ -264,6 +264,8 @@
       Carsten Grohmann
     * Now MoinMoin does not anymore think that every page links to various user
       homepages anymore.
+    * Now multiple formatters can be used per request, the send_page code was
+      not reentrant to this regard. Fixes "empty" search results.
 
   Other changes:
     * HINT: instead of "from MoinMoin.multiconfig import DefaultConfig" you