view MoinMoin/macro/ @ 3243:1ad6243cdf06

macros: refactor for new arg parser
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 12 Mar 2008 00:23:45 +0100
parents bb2e053067fb
children 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):
    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)

    return ''