changeset 3682:552982e930cc

globaledit script: also cleanup *Template pages
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 08 Jun 2008 18:04:27 +0200
parents 457a1f43f7eb
children 9fe5af566195
files MoinMoin/script/maint/globaledit.py
diffstat 1 files changed, 12 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/globaledit.py	Sun Jun 08 16:26:19 2008 +0200
+++ b/MoinMoin/script/maint/globaledit.py	Sun Jun 08 18:04:27 2008 +0200
@@ -1,4 +1,4 @@
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
 """
 MoinMoin - do global changes to all pages in a wiki.
 
@@ -35,7 +35,7 @@
         MoinScript.__init__(self, argv, def_values)
 
     def do_edit(self, pagename, origtext):
-        if pagename in ['LocalSpellingWords', 'LocalBadContent', ] or pagename.endswith('Template'):
+        if pagename in ['LocalSpellingWords', 'LocalBadContent', ]:
             return origtext
         language_line = format_line = masterpage = None
         acl_lines = []
@@ -75,20 +75,23 @@
         if aclold in acl_lines:
             acl_lines.remove(aclold)
         if not acl_lines and (
-            masterpage is None or masterpage not in ['FrontPage', 'WikiSandBox', ] and not masterpage.endswith('Template')):
+            masterpage is None and not pagename.endswith('Template') or
+            masterpage not in ['FrontPage', 'WikiSandBox', ] and not (pagename.endswith('Template') or masterpage.endswith('Template'))):
             acl_lines = ['#acl -All:write Default']
         if not master_lines:
             master_lines = ['##master-page:Unknown-Page', '##master-date:Unknown-Date', ]
 
-        c1old = "## Please edit system and help pages ONLY in the moinmaster wiki! For more"
-        c2old = "## information, please see MoinMaster:MoinPagesEditorGroup."
-        c1 = "## Please edit system and help pages ONLY in the master wiki!"
-        c2 = "## For more information, please see MoinMoin:MoinDev/Translation."
-        for c in (c1old, c2old, c1, c2):
+        cold = [u"## Please edit system and help pages ONLY in the moinmaster wiki! For more",
+                u"## information, please see MoinMaster:MoinPagesEditorGroup.",
+        ]
+        cnew = [u"## Please edit system and help pages ONLY in the master wiki!",
+                u"## For more information, please see MoinMoin:MoinDev/Translation.",
+        ]
+        for c in cold + cnew:
             if c in comment_lines:
                 comment_lines.remove(c)
 
-        comment_lines = [c1, c2, ] + comment_lines
+        comment_lines = cnew + comment_lines
 
         if content_lines and content_lines[-1].strip(): # not an empty line at EOF
             content_lines.append('')