changeset 490:d89a77a21e55

CollectLists: regex keyword replaced by search_expression. Instead of filtereing of request.rootpage.getPageList now search.searchPages is called.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 03 Feb 2010 18:10:22 +0100
parents c00d5e661913
children 435dc7e10d78
files data/plugin/macro/CollectLists.py
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/CollectLists.py	Wed Feb 03 17:20:22 2010 +0100
+++ b/data/plugin/macro/CollectLists.py	Wed Feb 03 18:10:22 2010 +0100
@@ -18,14 +18,14 @@
     By using the keyword transpose the table is shown transposed. Until transpose is not part
     of the databrowser widget itselfs we don't support filter_selection by transpose=True.
     
-    <<CollectLists(regex=^Examplepage/(.*))>
+    <<CollectLists(search_expression=title:Examplepage/)>
 
     @copyright: 2006 by michael cohen <scudette@users.sourceforge.net> (PageDicts)
     @copyright: 2008-2010 by MoinMoin:ReimarBauer (completly rewritten)
     @license: GNU GPL, see COPYING for details.
 """
 import re
-from MoinMoin import wikiutil
+from MoinMoin import wikiutil, search
 from MoinMoin.Page import Page
 from MoinMoin.util.dataset import TupleDataset, Column
 from MoinMoin.wikidicts import Dict
@@ -39,7 +39,7 @@
                       transpose=False,
                       filter_column_value=u'',
                       parser=u'text_moin_wiki',
-                      regex=None,
+                      search_expression=None,
                       filter_selection=u'NeverExistingDefaultFilter'):
 
     """
@@ -65,10 +65,12 @@
         # Don't filter if syntax was wrong
         filter_column_value = u''
 
-    if regex is None:
-        regex = '^%s/(.*)' % pagename
-    filterfn = re.compile(regex).search
-    pages = request.rootpage.getPageList(exists=1, filter=filterfn)
+    if search_expression is None:
+        search_expression = 'title:%s/' % pagename
+
+    search_result = search.searchPages(request, search_expression)
+    pages = [title.page_name for title in search_result.hits]
+
     if not pages:
         return _("Page '%(new_pagename)s' does not exist or you don't have enough rights.") % {"new_pagename": pagename}