changeset 617:cf420addd95c

removed MoinMoinNoFooter at many places, added call to theme.send_closing_html() where needed
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 05 May 2006 13:31:08 +0200
parents 3b08d9413589
children e0cbf33ff15c
files MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/action/AttachFile.py MoinMoin/action/Despam.py MoinMoin/action/LikePages.py MoinMoin/action/LocalSiteMap.py MoinMoin/action/MyPages.py MoinMoin/action/SubscribeUser.py MoinMoin/action/backup.py MoinMoin/action/fullsearch.py MoinMoin/action/links.py MoinMoin/action/login.py MoinMoin/action/titleindex.py MoinMoin/request.py MoinMoin/stats/hitcounts.py MoinMoin/stats/pagesize.py MoinMoin/stats/useragents.py MoinMoin/theme/__init__.py MoinMoin/wikiaction.py
diffstat 20 files changed, 47 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/Page.py	Fri May 05 13:31:08 2006 +0200
@@ -10,7 +10,7 @@
 
 from MoinMoin import config, caching, user, util, wikiutil
 from MoinMoin.logfile import eventlog
-from MoinMoin.util import filesys, MoinMoinNoFooter, timefuncs
+from MoinMoin.util import filesys, timefuncs
 
 class Page:
     """Page - Manage an (immutable) page associated with a WikiName.
@@ -949,7 +949,6 @@
         text = self.get_raw_body()
         text = self.encodeTextMimeType(text)
         self.request.write(text)
-        raise MoinMoinNoFooter
 
 
     def send_page(self, request, msg=None, **keywords):
@@ -1260,6 +1259,7 @@
                 cache.update('\n'.join(links) + '\n', True)
 
         request.clock.stop('send_page')
+        request.theme.send_closing_html()
 
     def getFormatterName(self):
         """ Return a formatter name as used in the caching system
--- a/MoinMoin/PageEditor.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/PageEditor.py	Fri May 05 13:31:08 2006 +0200
@@ -429,7 +429,8 @@
 
         self.request.write(self.request.formatter.endContent())
         self.request.theme.send_footer(self.page_name)
-        
+        self.request.theme.send_closing_html()
+
     def sendCancel(self, newtext, rev):
         """
         User clicked on Cancel button. If edit locking is active,
--- a/MoinMoin/PageGraphicalEditor.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/PageGraphicalEditor.py	Fri May 05 13:31:08 2006 +0200
@@ -353,4 +353,4 @@
 
         self.request.write(self.request.formatter.endContent()) # end content div
         self.request.theme.send_footer(self.page_name)
-
+        self.request.theme.send_closing_html()
--- a/MoinMoin/action/AttachFile.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/AttachFile.py	Fri May 05 13:31:08 2006 +0200
@@ -29,7 +29,7 @@
 import os, mimetypes, time, zipfile
 from MoinMoin import config, user, util, wikiutil, packages
 from MoinMoin.Page import Page
-from MoinMoin.util import MoinMoinNoFooter, filesys
+from MoinMoin.util import filesys
 
 action_name = __name__.split('.')[-1]
 
@@ -507,7 +507,7 @@
     send_uploadform(pagename, request)
     request.write('</div>\n') # end content div
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 def do_upload(pagename, request):
     _ = request.getText
@@ -650,8 +650,6 @@
     # send data
     shutil.copyfileobj(open(fpath, 'rb'), request, 8192)
 
-    raise MoinMoinNoFooter
-
 def install_package(pagename, request):
     _ = request.getText
 
@@ -826,9 +824,8 @@
     send_uploadform(pagename, request)
     request.write('</div>\n') # end content div
 
-    # send footer
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 #############################################################################
 ### File attachment administration
--- a/MoinMoin/action/Despam.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/Despam.py	Fri May 05 13:31:08 2006 +0200
@@ -185,4 +185,5 @@
     # End content and send footer
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
+    request.theme.send_closing_html()
 
--- a/MoinMoin/action/LikePages.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/LikePages.py	Fri May 05 13:31:08 2006 +0200
@@ -55,7 +55,7 @@
     # End content and send footer
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
-        
+    request.theme.send_closing_html()
 
 def findMatches(pagename, request, s_re=None, e_re=None,):
     """ Find like pages
--- a/MoinMoin/action/LocalSiteMap.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/LocalSiteMap.py	Fri May 05 13:31:08 2006 +0200
@@ -43,7 +43,7 @@
 
     request.write(request.formatter.endContent()) # end content div
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 class LocalSiteMap:
     def __init__(self, name):
--- a/MoinMoin/action/MyPages.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/MyPages.py	Fri May 05 13:31:08 2006 +0200
@@ -87,5 +87,5 @@
 
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
+    request.theme.send_closing_html()
 
-
--- a/MoinMoin/action/SubscribeUser.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/SubscribeUser.py	Fri May 05 13:31:08 2006 +0200
@@ -28,6 +28,7 @@
 </form>
 """)
     request.theme.send_footer(pagename)
+    request.theme.send_closing_html()
 
 def show_result(pagename, request):
     _ = request.getText
@@ -42,7 +43,7 @@
     request.write(result)
 
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 def subscribe_users(request, usernamelist, pagename, formatter):
     _ = request.getText
@@ -87,6 +88,7 @@
     if not request.user.may.admin(pagename):
         request.http_headers()
         request.theme.send_title(_("You are not allowed to perform this action."), pagename=pagename)
+        request.theme.send_closing_html()
     elif not request.form.has_key('users'):
         show_form(pagename, request)
     else:
--- a/MoinMoin/action/backup.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/backup.py	Fri May 05 13:31:08 2006 +0200
@@ -13,7 +13,6 @@
 import os, re, time, tarfile
 import cStringIO
 from MoinMoin import wikiutil
-from MoinMoin.util import MoinMoinNoFooter
 
 def addFiles(path, tar, exclude):
     """ Add files in path to tar """
@@ -40,7 +39,6 @@
     for path in request.cfg.backup_include:
         addFiles(path, tar, exclude)
     tar.close()
-    raise MoinMoinNoFooter
 
 def restoreBackup(request, pagename):
     _ = request.getText
@@ -113,6 +111,7 @@
     
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
+    request.theme.send_closing_html()
 
 def sendMsg(request, pagename, msg):
     from MoinMoin import Page
--- a/MoinMoin/action/fullsearch.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/fullsearch.py	Fri May 05 13:31:08 2006 +0200
@@ -106,7 +106,7 @@
         output = results.pageList(request, request.formatter, info=info)        
     request.write(output)
 
-    # End content and send footer
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
+    request.theme.send_closing_html()
 
--- a/MoinMoin/action/links.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/links.py	Fri May 05 13:31:08 2006 +0200
@@ -7,10 +7,7 @@
     @copyright: 2001 by Jürgen Hermann <jh@web.de>
     @license: GNU GPL, see COPYING for details.
 """
-
 from MoinMoin import config, wikiutil
-from MoinMoin.util import MoinMoinNoFooter
-
 
 def execute(pagename, request):
     _ = request.getText
@@ -52,8 +49,7 @@
     if mimetype == "text/html":
         request.write('</pre>')
         request.theme.send_footer(pagename)
-    else:
-        raise MoinMoinNoFooter
+        request.theme.send_closing_html()
 
 def _emit(request, pagename):
     """ Send pagename, encode it if it contains spaces
--- a/MoinMoin/action/login.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/login.py	Fri May 05 13:31:08 2006 +0200
@@ -67,7 +67,7 @@
             
             request.write(userform.getLogin(request))
             
-            # End content and send footer
             request.write(request.formatter.endContent())
             request.theme.send_footer(self.pagename)
+            request.theme.send_closing_html()
 
--- a/MoinMoin/action/titleindex.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/action/titleindex.py	Fri May 05 13:31:08 2006 +0200
@@ -38,5 +38,3 @@
         for name in pages:
             request.write(name+'\r\n')
 
-    raise util.MoinMoinNoFooter
-
--- a/MoinMoin/request.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/request.py	Fri May 05 13:31:08 2006 +0200
@@ -1072,7 +1072,6 @@
                 from MoinMoin.action.AttachFile import execute
                 # TODO: what if pagename is None?
                 execute(pagename, self)
-                raise MoinMoinNoFooter           
 
             # 4. Or handle action
             else:
@@ -1107,8 +1106,8 @@
                     handler = getHandler(self, action)
                     handler(self.page.page_name, self)
 
-            # XXX temporary, to be removed later
-            self.theme.send_closing_html()
+            # every action that didn't use to raise MoinMoinNoFooter must call this now:
+            # self.theme.send_closing_html()
 
         except MoinMoinNoFooter:
             pass
--- a/MoinMoin/stats/hitcounts.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/stats/hitcounts.py	Fri May 05 13:31:08 2006 +0200
@@ -16,7 +16,6 @@
 
 from MoinMoin import caching, config, wikiutil
 from MoinMoin.Page import Page
-from MoinMoin.util import MoinMoinNoFooter
 from MoinMoin.formatter.text_html import Formatter
 from MoinMoin.logfile import eventlog, logfile
 
@@ -251,5 +250,4 @@
     # copy the image
     image.reset()
     shutil.copyfileobj(image, request, 8192)
-    raise MoinMoinNoFooter
 
--- a/MoinMoin/stats/pagesize.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/stats/pagesize.py	Fri May 05 13:31:08 2006 +0200
@@ -12,7 +12,6 @@
 
 from MoinMoin import wikiutil
 from MoinMoin.Page import Page
-from MoinMoin.util import MoinMoinNoFooter
 
 
 def linkto(pagename, request, params=''):
@@ -124,5 +123,4 @@
     # copy the image
     image.reset()
     shutil.copyfileobj(image, request, 8192)
-    raise MoinMoinNoFooter
 
--- a/MoinMoin/stats/useragents.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/stats/useragents.py	Fri May 05 13:31:08 2006 +0200
@@ -15,7 +15,6 @@
 
 from MoinMoin import wikiutil, caching 
 from MoinMoin.Page import Page
-from MoinMoin.util import MoinMoinNoFooter
 from MoinMoin.logfile import eventlog, logfile
 
 
@@ -183,5 +182,4 @@
     # copy the image
     image.reset()
     shutil.copyfileobj(image, request, 8192)
-    raise MoinMoinNoFooter
 
--- a/MoinMoin/theme/__init__.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/theme/__init__.py	Fri May 05 13:31:08 2006 +0200
@@ -1379,26 +1379,6 @@
         lang = self.request.content_lang
         return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))
 
-    # stuff moved from request.py
-    def send_closing_html(self):
-        """ generate timing info html and closing html tag """
-        request = self.request
-
-        # as this is the last chance to emit some html, we stop the clocks:
-        request.clock.stop('run')
-        request.clock.stop('total')
-
-        # Close html code
-        if not request.no_closing_html_code:
-            if (request.cfg.show_timings and
-                request.form.get('action', [None])[0] != 'print'):
-                request.write('<ul id="timings">\n')
-                for t in request.clock.dump():
-                    request.write('<li>%s</li>\n' % t)
-                request.write('</ul>\n')
-            #request.write('<!-- auth_method == %s -->' % repr(request.user.auth_method))
-            request.write('</body>\n</html>\n\n')
-
     # stuff from wikiutil.py
     def send_title(self, text, **keywords):
         """
@@ -1660,3 +1640,27 @@
         else:
             request.write(self.footer(d, **keywords))
 
+    # stuff moved from request.py
+    def send_closing_html(self):
+        """ generate timing info html and closing html tag,
+            everyone calling send_title must call this at the end to close
+            the body and html tags.
+        """
+        request = self.request
+
+        # as this is the last chance to emit some html, we stop the clocks:
+        request.clock.stop('run')
+        request.clock.stop('total')
+
+        # Close html code
+        if not request.no_closing_html_code:
+            if (request.cfg.show_timings and
+                request.form.get('action', [None])[0] != 'print'):
+                request.write('<ul id="timings">\n')
+                for t in request.clock.dump():
+                    request.write('<li>%s</li>\n' % t)
+                request.write('</ul>\n')
+            #request.write('<!-- auth_method == %s -->' % repr(request.user.auth_method))
+            request.write('</body>\n</html>\n\n')
+
+
--- a/MoinMoin/wikiaction.py	Fri May 05 12:41:10 2006 +0200
+++ b/MoinMoin/wikiaction.py	Fri May 05 13:31:08 2006 +0200
@@ -198,7 +198,7 @@
 
     request.write('</div>\n') # end content div
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 def do_info(pagename, request):
     if not request.user.may.read(pagename):
@@ -427,7 +427,7 @@
         
     request.write('</div>\n') # end content div
     request.theme.send_footer(pagename)
-
+    request.theme.send_closing_html()
 
 def do_recall(pagename, request):
     # We must check if the current page has different ACLs.
@@ -493,7 +493,6 @@
     page = Page(request, pagename)
     request.write('<!-- Transclusion of %s -->' % request.getQualifiedURL(page.url(request)))
     page.send_page(request, count_hit=0, content_only=1)
-    raise MoinMoinNoFooter
 
 
 def do_revert(pagename, request):
@@ -827,7 +826,6 @@
     request.http_headers(["Content-Type: %s; charset=%s" % (mimetype, config.charset)])
 
     Page(request, pagename, formatter=Formatter(request)).send_page(request)
-    raise MoinMoinNoFooter
 
 
 def do_chart(pagename, request):
@@ -855,7 +853,6 @@
         return request.page.send_page(request, msg=msg)
     
     func(pagename, request)
-    raise MoinMoinNoFooter
 
 
 def do_dumpform(pagename, request):
@@ -863,7 +860,6 @@
 
     request.http_headers()
     request.write("<html><body>%s</body></html>" % data)
-    raise MoinMoinNoFooter
 
 
 def do_test(pagename, request):
@@ -871,7 +867,6 @@
     request.http_headers(["Content-type: text/plain;charset=%s" % config.charset])
     request.write('MoinMoin Diagnosis\n======================\n\n')
     runTest(request)
-    raise MoinMoinNoFooter
 
 
 #############################################################################