Details

Applies to
Release 1.7.0
Purpose

Allow usage of search expressions like in <<FullSearch()>> when using the <<Include()>> macro.

Description

If the first parameter of <<Include()>> starts with a colon, it treats it as a search expression.

Author
Max Cantor

Patch

It was complaining about removing non-ASCII characters from the filename of my attachment, and I don't know how to remove non-ASCII characters that don't exist, so... here's my patch inline!

   1 diff -r 761c3a503be2 MoinMoin/macro/Include.py
   2 --- a/MoinMoin/macro/Include.py Sat Jun 21 23:38:41 2008 +0200
   3 +++ b/MoinMoin/macro/Include.py Tue Nov 16 17:08:27 2010 -0500
   4 @@ -19,7 +19,7 @@
   5  generates_headings = True
   6 
   7  import re, StringIO
   8 -from MoinMoin import wikiutil
   9 +from MoinMoin import wikiutil, search
  10  from MoinMoin.Page import Page
  11 
  12 
  13 @@ -83,6 +83,9 @@
  14          else:
  15              # Get user filtered readable page list
  16              pagelist = request.rootpage.getPageList(filter=inc_match.match)
  17 +    elif inc_name.startswith(":"):
  18 +        found_pages = search.searchPages(request, inc_name[1:], sort='page_name').hits
  19 +        pagelist = [fp.page_name for fp in found_pages]
  20 
  21      # sort and limit page list
  22      pagelist.sort()

Discussion

/!\ This stuff is completely unclear (how can one reproduce what problem?)

(!) Why do you file a patch for moin 1.7.0 which is outdated and won't get any changes any more?

Plan


CategoryMoinMoinPatch

MoinMoin: MoinMoinPatch/IncludeBySearchResults (last edited 2010-11-16 22:58:14 by ThomasWaldmann)