from MoinMoin import wikiutil
from MoinMoin.Page import Page

def execute(pagename, request):
    name = request.form.get("do", ["Error"])[0]
    try:
        action_dialog = wikiutil.importPlugin(request.cfg, 'forms', name, 'Dialog')
        action_dialog(request).action(pagename)
    except wikiutil.PluginError:
        msg = 'Dialog not found. (todo: better error message)'
        Page(request, pagename).send_page(request, msg=msg)


    
