view MoinMoin/action/ @ 1550:a4f0632414da

using request.cfg.cache more
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 14 Sep 2006 22:49:42 +0200
parents e866e8975431
children ed44b93599b5
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - show some statistics chart

    @copyright: 2000-2004 by Jürgen Hermann <>,
                2006 by 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
        msg = _("You are not allowed to view this page.")
        return, msg=msg)

    if not request.cfg.chart_options:
        msg = _("Charts are not available!")
        return, msg=msg)

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

        func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
    except (ImportError, AttributeError), err:
        msg = _('Bad chart type "%s"!') % chart_type
        return, msg=msg)

    func(pagename, request)