Back to index

moin  1.9.0~rc2
Functions | Variables
MoinMoin.macro.PageList Namespace Reference

Functions

def execute

Variables

list Dependencies = ["namespace"]

Function Documentation

def MoinMoin.macro.PageList.execute (   macro,
  args 
)

Definition at line 16 of file PageList.py.

00016 
00017 def execute(macro, args):
00018     _ = macro._
00019     case = 0
00020 
00021     # If called with empty or no argument, default to regex search for .+, the full page list.
00022     needle = wikiutil.get_unicode(macro.request, args, 'needle', u'regex:.+')
00023 
00024     # With whitespace argument, return same error message as FullSearch
00025     if not needle.strip():
00026         err = _('Please use a more selective search term instead of {{{"%s"}}}', wiki=True) % needle
00027         return '<span class="error">%s</span>' % err
00028 
00029     # Return a title search for needle, sorted by name.
00030     try:
00031         results = search.searchPages(macro.request, needle,
00032                                      titlesearch=1, case=case,
00033                                      sort='page_name')
00034         ret = results.pageList(macro.request, macro.formatter, paging=False)
00035     except ValueError:
00036         # same error as in MoinMoin/action/fullsearch.py, keep it that way!
00037         ret = ''.join([macro.formatter.text('<<PageList('),
00038                       _('Your search query {{{"%s"}}} is invalid. Please refer to '
00039                         'HelpOnSearching for more information.', wiki=True,
00040                         percent=True) % wikiutil.escape(needle),
00041                       macro.formatter.text(')>>')])
00042     return ret

Variable Documentation

Definition at line 13 of file PageList.py.