view MoinMoin/action/ @ 2966:ba14d391c2ba

Refactor all modules to use the new add_msg interface in 1.7 (done by Frederico Lorenzi). Should not be backported to 1.6 but instead the separate patch from should be used.
author Alexander Schremmer <alex AT alexanderweb DOT de>
date Sun, 23 Dec 2007 23:52:43 +0100
parents bb2e053067fb
children 40acd13fb3d6 37306fba2189
line wrap: on
line source

# -*- coding: iso-8859-1 -*-
    MoinMoin - show some statistics chart

    @copyright: 2000-2004 Juergen Hermann <>,
                2006 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.
from MoinMoin.util import pysupport

def execute(pagename, request):
    """ Show page charts """
    _ = request.getText
    if not
        request.theme.add_msg(_("You are not allowed to view this page."), "error")

    if not request.cfg.chart_options:
        request.theme.add_msg(_("Charts are not available!"), "error")

    chart_type = request.form.get('type', [''])[0].strip()
    if not chart_type:
        request.theme.add_msg(_('You need to provide a chart type!'), "error")

        func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
    except (ImportError, AttributeError):
        request.theme.add_msg(_('Bad chart type "%s"!') % chart_type, "error")

    func(pagename, request)