~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/action/chart.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20080622211713-inlv5k4eifxckelr
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
                2006 MoinMoin:ThomasWaldmann
7
7
    @license: GNU GPL, see COPYING for details.
8
8
"""
9
 
from MoinMoin import wikiutil
10
9
from MoinMoin.util import pysupport
11
10
 
12
11
def execute(pagename, request):
20
19
        request.theme.add_msg(_("Charts are not available!"), "error")
21
20
        return request.page.send_page()
22
21
 
23
 
    chart_type = request.values.get('type', '').strip()
 
22
    chart_type = request.form.get('type', [''])[0].strip()
24
23
    if not chart_type:
25
24
        request.theme.add_msg(_('You need to provide a chart type!'), "error")
26
25
        return request.page.send_page()
28
27
    try:
29
28
        func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
30
29
    except (ImportError, AttributeError):
31
 
        request.theme.add_msg(_('Bad chart type "%s"!') % wikiutil.escape(chart_type), "error")
 
30
        request.theme.add_msg(_('Bad chart type "%s"!') % chart_type, "error")
32
31
        return request.page.send_page()
33
32
 
34
33
    func(pagename, request)