view data/plugin/action/loadactions.py @ 622:12465aa315be

add code from ActionMarket/FormSubmit (form_submit-1.7.tar.gz) - outdated code for moin 1.7/1.8
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 17:09:15 +0100
parents
children 5f499a634857
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.
"""

import os, sys

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.get("actions[]"):
        handler = getHandler(request, action)
        try:
            handler(pagename, request)
        except SubmitError:
            # Stop executing next actions while there is an error
            break