from MoinMoin import wikiutil

Dependencies = ["time"]


def execute(macro, args):
    if args is None:
        args = ''
            
    # split args
    args = args.split(',') # XXX sane quoting
    name = args[0].strip()
    try:
        dialog = wikiutil.importPlugin(macro.request.cfg, 'forms', name, 'Dialog')
    except wikiutil.PluginError:
        return 'Dialog not found.'

    return dialog(macro.request).macro(args[1:])
