changeset 3533:c1fa007b9e2f

macro.PageList: changed PageList to old macro execute
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 26 Apr 2008 22:41:44 +0200
parents 130120e11d9d
children f94bead41c84
files MoinMoin/macro/PageList.py MoinMoin/macro/__init__.py
diffstat 2 files changed, 32 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/macro/PageList.py	Sat Apr 26 22:41:44 2008 +0200
@@ -0,0 +1,31 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - PageList
+
+    print a list of pages whose title matches the search term
+
+    @copyright: @copyright: 2001-2003 Juergen Hermann <jh@web.de>,
+                2003-2008 MoinMoin:ThomasWaldmann
+                2008 MoinMoin:ReimarBauer
+    @license: GNU GPL, see COPYING for details.
+"""
+
+Dependencies = ["namespace"]
+from MoinMoin import search, wikiutil
+
+def execute(macro, args):
+    _ = macro._
+    case = 0
+
+    # If called with empty or no argument, default to regex search for .+, the full page list.
+    needle = wikiutil.get_unicode(macro.request, args, 'needle', u'regex:.+')
+
+    # With whitespace argument, return same error message as FullSearch
+    if not needle.strip():
+        err = _('Please use a more selective search term instead of {{{"%s"}}}', wiki=True) % needle
+        return '<span class="error">%s</span>' % err
+
+    # Return a title search for needle, sorted by name.
+    results = search.searchPages(macro.request, needle,
+              titlesearch=1, case=case, sort='page_name')
+    return results.pageList(macro.request, macro.formatter, paging=False)
--- a/MoinMoin/macro/__init__.py	Sat Apr 26 22:40:43 2008 +0200
+++ b/MoinMoin/macro/__init__.py	Sat Apr 26 22:41:44 2008 +0200
@@ -28,7 +28,7 @@
 
 names = ["TitleSearch", "WordIndex", "TitleIndex", "GoTo",
          # Macros with arguments
-         "Icon", "PageList", "Date", "DateTime", "Anchor", "MailTo", "GetVal", "TemplateList",
+         "Icon", "Date", "DateTime", "Anchor", "MailTo", "GetVal", "TemplateList",
 ]
 
 #############################################################################
@@ -62,7 +62,6 @@
 
     Dependencies = {
         "TitleSearch": ["namespace"],
-        "PageList": ["namespace"],
         "TemplateList": ["namespace"],
         "WordIndex": ["namespace"],
         "TitleIndex": ["namespace"],
@@ -156,24 +155,6 @@
         from MoinMoin.macro.FullSearch import search_box
         return search_box("titlesearch", self)
 
-    def macro_PageList(self, needle=None):
-        from MoinMoin import search
-        _ = self._
-        case = 0
-
-        # If called with empty or no argument, default to regex search for .+, the full page list.
-        needle = wikiutil.get_unicode(self.request, needle, 'needle', u'regex:.+')
-
-        # With whitespace argument, return same error message as FullSearch
-        if not needle.strip():
-            err = _('Please use a more selective search term instead of {{{"%s"}}}', wiki=True) % needle
-            return '<span class="error">%s</span>' % err
-
-        # Return a title search for needle, sorted by name.
-        results = search.searchPages(self.request, needle,
-                titlesearch=1, case=case, sort='page_name')
-        return results.pageList(self.request, self.formatter, paging=False)
-
     def macro_TemplateList(self, needle=u'.+'):
         # TODO: this should be renamed (RegExPageNameList?), it does not list only Templates...
         _ = self._