view data/plugin/action/loadactions.py @ 627:f683dea1ac1b

FormSubmit: fix misc. issues * actions[] is a list, so use form.getlist * if getHandler returns None, don't call that * misc. file upload related fixes for werkzeug * use taintfilename on supplied filenames for better security
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 19:41:11 +0100
parents 5f499a634857
children 819c4121f9a0
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - loadactions Action
    
    Triggers multiple actions at once.
    Actions are defined in actions[] CGI parameter, 
    where actions[] is array of action names.

    @copyright: 2008 by Peter Bodi <petrdll@centrum.sk>
    @license: GNU GPL, see COPYING for details.
"""

from MoinMoin import wikiutil
from MoinMoin.Page import Page
from MoinMoin.action import ActionBase
from MoinMoin.action import getHandler

from submitbase import SubmitError


def execute(pagename, request):
    for action in request.form.getlist("actions[]"):
        handler = getHandler(request, action)
        try:
            if handler:
                handler(pagename, request)
        except SubmitError:
            # Stop executing next actions if there is an error
            break