changeset 633:1b852a8055fe

move 'test' action to MoinMoin/action, use ActionBase
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 12 May 2006 17:05:22 +0200
parents fefa8de5dac7
children 31797904ee5a
files MoinMoin/action/test.py MoinMoin/multiconfig.py MoinMoin/wikiaction.py docs/CHANGES
diffstat 4 files changed, 43 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/action/test.py	Fri May 12 17:05:22 2006 +0200
@@ -0,0 +1,40 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - test action
+
+    This action allows you to run some tests and show some data about your system.
+
+    If you don't want this action to be available due to system privacy reasons,
+    do this in your wiki/farm config:
+
+    actions_excluded = ["test"]
+    
+    @copyright: 2006 MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin import config
+from MoinMoin.wikitest import runTest
+from MoinMoin.action import ActionBase
+
+class test(ActionBase):
+    """ test and show info action
+
+    Note: the action name is the class name
+    """
+    def do_action(self):
+        """ run tests """
+        request = self.request
+        request.http_headers(["Content-type: text/plain; charset=%s" % config.charset])
+        request.write('MoinMoin Diagnosis\n======================\n\n')
+        runTest(request)
+        return True, ""
+
+    def do_action_finish(self, success):
+        """ we don't want to do the default stuff, but just NOTHING """
+        pass
+
+def execute(pagename, request):
+    """ Glue code for actions """
+    test(pagename, request).render()
+
--- a/MoinMoin/multiconfig.py	Thu May 11 10:38:04 2006 +0200
+++ b/MoinMoin/multiconfig.py	Fri May 12 17:05:22 2006 +0200
@@ -170,7 +170,7 @@
     acl_rights_after = u""
     acl_rights_valid = ['read', 'write', 'delete', 'revert', 'admin']
     
-    actions_excluded = [] # ['DeletePage', 'AttachFile', 'RenamePage']
+    actions_excluded = [] # ['DeletePage', 'AttachFile', 'RenamePage', 'test', ]
     allow_xslt = 0
     attachments = None # {'dir': path, 'url': url-prefix}
     auth = [authmodule.moin_cookie]
--- a/MoinMoin/wikiaction.py	Thu May 11 10:38:04 2006 +0200
+++ b/MoinMoin/wikiaction.py	Fri May 12 17:05:22 2006 +0200
@@ -783,13 +783,6 @@
     request.http_headers()
     request.write("<html><body>%s</body></html>" % data)
 
-def do_test(pagename, request):
-    """ run the unit tests """
-    from MoinMoin.wikitest import runTest
-    request.http_headers(["Content-type: text/plain;charset=%s" % config.charset])
-    request.write('MoinMoin Diagnosis\n======================\n\n')
-    runTest(request)
-
 
 #############################################################################
 ### Dispatching
--- a/docs/CHANGES	Thu May 11 10:38:04 2006 +0200
+++ b/docs/CHANGES	Fri May 12 17:05:22 2006 +0200
@@ -33,6 +33,8 @@
     critical stuff gets committed with -m "... (backport to 1.5)" and then
     backported to 1.5. :) Commits to 1.5 done in any other way are likely to
     get reverted.
+  * refactored some actions to use ActionBase base class
+  * moved "test" action from wikiaction to MoinMoin/action/ (and use ActionBase)
 
 
 Version 1.5.current: