view MoinMoin/macro/ @ 5597:ced05deb11ae 1.9.2

cfg.history_paging: fix grammar/remove performance warning (we don't do that at other places either)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 28 Feb 2010 23:49:03 +0100
parents ef1313a4add2
line wrap: on
line source

# -*- coding: iso-8859-1 -*-
    MoinMoin - Create list of LikePages

    @copyright: 2004 Johannes Berg <>
    @license: GNU GPL, see COPYING for details.

Dependencies = ['namespace']

from MoinMoin.action import LikePages

def macro_LikePages(macro, text=u'(none)'):
    request = macro.request
    # we don't want to spend much CPU for spiders requesting nonexisting pages
    if not request.isSpiderAgent:
        pagename =

        # Get matches
        start, end, matches = LikePages.findMatches(pagename, request)

        # Render matches
        if matches and not isinstance(matches, (str, unicode)):
            return request.redirectedOutput(LikePages.showMatches, pagename, request, start, end, matches, False)
            # if we did not find any similar pages, we just render the text we got as argument:
            return request.formatter.text(text)
    # bots get nothing:
    return ''