changeset 5479:d3e1bae851ef

packages: config variable packagepages_actions_excluded introduced. This is used to exclude on default questionable actions for packages.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Mon, 01 Feb 2010 18:45:45 +0100
parents 2ce0e1c469aa
children 39cae9b6c0c8
files MoinMoin/_tests/test_packages.py MoinMoin/config/multiconfig.py MoinMoin/packages.py
diffstat 3 files changed, 13 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/test_packages.py	Mon Feb 01 15:31:27 2010 +0100
+++ b/MoinMoin/_tests/test_packages.py	Mon Feb 01 18:45:45 2010 +0100
@@ -3,7 +3,8 @@
     MoinMoin - MoinMoin.packages tests
 
     @copyright: 2005 MoinMoin:AlexanderSchremmer,
-                2007 Federico Lorenzi
+                2007 Federico Lorenzi,
+                2010 MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
 """
 
@@ -34,14 +35,10 @@
 print|foo
 ReplaceUnderlay|testdatei|TestSeite2
 IgnoreExceptions|True
-DeletePage|TestSeiteDoesNotExist|Test ...
-DeletePage|FooPage|Test ...
 IgnoreExceptions|False
 AddRevision|foofile|FooPage
 AddRevision|foofile|FooPage
-setthemename|foo
 #foobar
-installplugin|foo|local|parser|testy
 """
 
     def extract_file(self, filename):
@@ -66,9 +63,7 @@
             py.test.skip('This test needs to be run using the test wiki.')
 
     def teardown_class(self):
-        DebugPackage(self.request, u"""moinmoinpackage|1
-DeletePage|FooPage|Test ...
-""").installPackage()
+        nuke_page(self.request, "FooPage")
 
     def testBasicPackageThings(self):
         become_superuser(self.request)
--- a/MoinMoin/config/multiconfig.py	Mon Feb 01 15:31:27 2010 +0100
+++ b/MoinMoin/config/multiconfig.py	Mon Feb 01 18:45:45 2010 +0100
@@ -430,6 +430,9 @@
     openid_server_restricted_users_group = None
     openid_server_enable_user = False
 
+    # actions to exclude from packagepages action
+    packagepages_actions_excluded = ['setthemename', 'copythemefile', 'installplugin', 'renamepage', 'deletepage', 'delattachment']
+
     page_credits = [
         # Feel free to add other credits, but PLEASE do NOT change or remove
         # the following links - you help us by keeping them "as is":
--- a/MoinMoin/packages.py	Mon Feb 01 15:31:27 2010 +0100
+++ b/MoinMoin/packages.py	Mon Feb 01 18:45:45 2010 +0100
@@ -3,7 +3,7 @@
     MoinMoin - Package Installer
 
     @copyright: 2005 MoinMoin:AlexanderSchremmer,
-                2007 MoinMoin:ReimarBauer
+                2007-2010 MoinMoin:ReimarBauer
     @license: GNU GPL, see COPYING for details.
 """
 
@@ -414,7 +414,12 @@
             if fnname == '':
                 continue
             try:
-                fn = getattr(self, "do_" + fnname)
+                if fnname in self.request.cfg.packagepages_actions_excluded:
+                    self.msg += u"action package %s: excluded \n" % elements[0].strip()
+                    success = False
+                    continue
+                else:
+                    fn = getattr(self, "do_" + fnname)
             except AttributeError:
                 self.msg += u"Exception RuntimeScriptException: %s\n" % (
                         _("Unknown function %(func)s in line %(lineno)i.") %