changeset 487:506dd8b80de7

CollectLists: new keyword regex which can be used to set a different regex than the old default of ^Pagename/(.*)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Wed, 03 Feb 2010 17:08:15 +0100
parents e484ef64e7a0
children 4ec9f902edaf
files data/plugin/macro/CollectLists.py
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/CollectLists.py	Mon Feb 01 23:33:18 2010 +0100
+++ b/data/plugin/macro/CollectLists.py	Wed Feb 03 17:08:15 2010 +0100
@@ -17,9 +17,11 @@
     get only rows shown where that name was found.
     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/(.*))>
 
     @copyright: 2006 by michael cohen <scudette@users.sourceforge.net> (PageDicts)
-    @copyright: 2008-2009 by MoinMoin:ReimarBauer (completly rewritten)
+    @copyright: 2008-2010 by MoinMoin:ReimarBauer (completly rewritten)
     @license: GNU GPL, see COPYING for details.
 """
 import re
@@ -37,6 +39,7 @@
                       transpose=False,
                       filter_column_value=u'',
                       parser=u'text_moin_wiki',
+                      regex=None,
                       filter_selection=u'NeverExistingDefaultFilter'):
 
     """
@@ -62,8 +65,9 @@
         # Don't filter if syntax was wrong
         filter_column_value = u''
 
-    needle = '^%s/(.*)' % pagename
-    filterfn = re.compile(needle).search
+    if regex is None:
+        regex = '^%s/(.*)' % pagename
+    filterfn = re.compile(regex).search
     pages = request.rootpage.getPageList(exists=1, filter=filterfn)
     if not pages:
         return _("Page '%(new_pagename)s' does not exist or you don't have enough rights.") % {"new_pagename": pagename}