changeset 3229:09657fbd4aa2

converted to arg parser
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 09 Mar 2008 19:51:01 +0100
parents c7fabea3fb4f
children 8d6f935ac0e0
files MoinMoin/macro/EditTemplates.py MoinMoin/macro/OrphanedPages.py MoinMoin/macro/PageSize.py MoinMoin/macro/ShowSmileys.py MoinMoin/macro/SystemAdmin.py MoinMoin/macro/TeudView.py MoinMoin/macro/WantedPages.py
diffstat 7 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/EditTemplates.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/EditTemplates.py	Sun Mar 09 19:51:01 2008 +0100
@@ -7,25 +7,24 @@
 """
 
 Dependencies = ["language"]
-
-def execute(self, args):
+def macro_EditTemplates(macro):
     result = ''
     # we don't want to spend much CPU for spiders requesting nonexisting pages
-    if not self.request.isSpiderAgent:
+    if not macro.request.isSpiderAgent:
         # Get list of template pages readable by current user
-        filterfn = self.request.cfg.cache.page_template_regex.search
-        templates = self.request.rootpage.getPageList(filter=filterfn)
+        filterfn = macro.request.cfg.cache.page_template_regex.search
+        templates = macro.request.rootpage.getPageList(filter=filterfn)
         result = []
         if templates:
             templates.sort()
-            page = self.formatter.page
+            page = macro.formatter.page
             # send list of template pages
-            result.append(self.formatter.bullet_list(1))
+            result.append(macro.formatter.bullet_list(1))
             for template in templates:
-                result.append(self.formatter.listitem(1))
-                result.append(page.link_to(self.request, template, querystr={'action': 'edit', 'template': template}))
-                result.append(self.formatter.listitem(0))
-            result.append(self.formatter.bullet_list(0))
+                result.append(macro.formatter.listitem(1))
+                result.append(page.link_to(macro.request, template, querystr={'action': 'edit', 'template': template}))
+                result.append(macro.formatter.listitem(0))
+            result.append(macro.formatter.bullet_list(0))
         result = ''.join(result)
     return result
 
--- a/MoinMoin/macro/OrphanedPages.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/OrphanedPages.py	Sun Mar 09 19:51:01 2008 +0100
@@ -8,7 +8,7 @@
 
 Dependencies = ["pages"]
 
-def execute(macro, args):
+def macro_OrphanedPages(macro):
     _ = macro.request.getText
 
     if macro.request.mode_getpagelinks: # prevent recursion
--- a/MoinMoin/macro/PageSize.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/PageSize.py	Sun Mar 09 19:51:01 2008 +0100
@@ -8,7 +8,7 @@
 
 Dependencies = ["pages"]
 
-def execute(macro, args):
+def macro_PageSize(macro):
     if macro.request.isSpiderAgent: # reduce bot cpu usage
         return ''
 
--- a/MoinMoin/macro/ShowSmileys.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/ShowSmileys.py	Sun Mar 09 19:51:01 2008 +0100
@@ -18,7 +18,7 @@
 
 Dependencies = ['user'] # different users have different themes and different user prefs (text/gfx)
 
-def execute(macro, args):
+def macro_ShowSmileys(macro):
     _ = macro.request.getText
     fmt = macro.formatter
 
--- a/MoinMoin/macro/SystemAdmin.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/SystemAdmin.py	Sun Mar 09 19:51:01 2008 +0100
@@ -13,7 +13,7 @@
 
 Dependencies = ["time"]
 
-def execute(macro, args):
+def macro_SystemAdmin(macro):
     _ = macro.request.getText
     request = macro.request
 
--- a/MoinMoin/macro/TeudView.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/TeudView.py	Sun Mar 09 19:51:01 2008 +0100
@@ -26,7 +26,7 @@
 
 Dependencies = ["time"]
 
-def execute(macro, args):
+def macro_TeudView(macro):
     if _imperr: return "Error in TeudView macro: " + str(_imperr)
 
     #dtdfile = xmldoc.getDTDPath()
--- a/MoinMoin/macro/WantedPages.py	Sun Mar 09 16:50:57 2008 +0100
+++ b/MoinMoin/macro/WantedPages.py	Sun Mar 09 19:51:01 2008 +0100
@@ -10,7 +10,7 @@
 
 Dependencies = ["pages"]
 
-def execute(macro, args):
+def macro_WantedPages(macro):
     request = macro.request
     _ = request.getText