changeset 3241:03b3c6fd70e3

changed to new arg parser
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 11 Mar 2008 00:04:39 +0100
parents e8fcaf99434f
children 924a9abe5689
files MoinMoin/macro/AttachInfo.py MoinMoin/macro/AttachList.py MoinMoin/macro/EditedSystemPages.py MoinMoin/macro/FullSearch.py MoinMoin/macro/FullSearchCached.py
diffstat 5 files changed, 17 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/AttachInfo.py	Mon Mar 10 23:28:17 2008 +0100
+++ b/MoinMoin/macro/AttachInfo.py	Tue Mar 11 00:04:39 2008 +0100
@@ -11,10 +11,11 @@
 
 from MoinMoin.action.AttachFile import info
 
-def execute(macro, args):
-    pagename = macro.formatter.page.page_name
-    if args:
-        pagename = args
-    result = info(pagename, macro.request)
-    return result
+def macro_AttachInfo(macro, pagename=None):
+    """ generates info how much attachments stored on a page """
+    if not pagename:
+        pagename = macro.formatter.page.page_name
+    
+    return info(pagename, macro.request)
 
+
--- a/MoinMoin/macro/AttachList.py	Mon Mar 10 23:28:17 2008 +0100
+++ b/MoinMoin/macro/AttachList.py	Tue Mar 11 00:04:39 2008 +0100
@@ -15,15 +15,10 @@
 
 from MoinMoin.action.AttachFile import _build_filelist
 
-def execute(macro, args):
+def macro_AttachList(macro, pagename=None, mime_type=u'*'):
     # defaults if we don't get anything better
-    pagename = macro.formatter.page.page_name
-    mime_type = '*'
-    if args:
-        args = args.split(',')
-        if args[0].strip():
-            pagename = args[0].strip()
-        if len(args) > 1 and args[1].strip():
-            mime_type = args[1].strip()
+    if not pagename:
+        pagename = macro.formatter.page.page_name
+
     return _build_filelist(macro.request, pagename, 0, 1, mime_type=mime_type)
 
--- a/MoinMoin/macro/EditedSystemPages.py	Mon Mar 10 23:28:17 2008 +0100
+++ b/MoinMoin/macro/EditedSystemPages.py	Tue Mar 11 00:04:39 2008 +0100
@@ -8,7 +8,7 @@
 
 class EditedSystemPages:
 
-    def __init__(self, macro, args):
+    def __init__(self, macro):
         self.macro = macro
         self.request = macro.request
         self.formatter = macro.formatter
@@ -48,7 +48,7 @@
         return ''.join(result)
 
 
-def execute(macro, args):
+def macro_EditedSystemPages(macro):
     """ Temporary glue code to use with moin current macro system """
-    return EditedSystemPages(macro, args).renderInPage()
+    return EditedSystemPages(macro).renderInPage()
 
--- a/MoinMoin/macro/FullSearch.py	Mon Mar 10 23:28:17 2008 +0100
+++ b/MoinMoin/macro/FullSearch.py	Tue Mar 11 00:04:39 2008 +0100
@@ -81,7 +81,8 @@
     return macro.formatter.rawHTML(html)
 
 
-def execute(macro, needle):
+def macro_FullSearch(macro, needle=None):
+    
     request = macro.request
     _ = request.getText
 
--- a/MoinMoin/macro/FullSearchCached.py	Mon Mar 10 23:28:17 2008 +0100
+++ b/MoinMoin/macro/FullSearchCached.py	Tue Mar 11 00:04:39 2008 +0100
@@ -9,7 +9,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-from MoinMoin.macro.FullSearch import execute
+from MoinMoin.macro.FullSearch import macro_FullSearch
 Dependencies = []
 
 # yes, that's all