view MoinMoin/macro/ @ 6087:538b7d0119cd

tagged release 1.9.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 17 Oct 2014 21:53:46 +0200
parents 378bfb1d0eec
line wrap: on
line source

    MoinMoin - AttachList Macro

    A macro to produce a list of attached files

    Usage: <<AttachList([pagename,mime_type])>>

    If pagename isn't set, the current pagename is used.
    If mime_type isn't given, all files are listed.

    @copyright: 2004 Jacob Cohen, Nigel Metheringham,
                2006-2013 MoinMoin:ReimarBauer
    @license: GNU GPL, see COPYING for details.

import re

from MoinMoin.action.AttachFile import _build_filelist

def macro_AttachList(macro, pagename=None, mime_type=u'*', search_term=u'.+'):
    # defaults if we don't get anything better
    if not pagename:
        pagename =
    filterfn = re.compile(search_term, re.U).search
    return _build_filelist(macro.request, pagename, 0, 1, mime_type=mime_type, filterfn=filterfn)