annotate MoinMoin/action/chart.py @ 5298:d57b74bc4cbd

formatter: text_html comment moved to docstring
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 20 Nov 2009 09:49:05 +0100
parents 8982d8226218
children e50b087c4572
rev   line source
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
2 """
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
3 MoinMoin - show some statistics chart
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1805
diff changeset
5 @copyright: 2000-2004 Juergen Hermann <jh@web.de>,
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1805
diff changeset
6 2006 MoinMoin:ThomasWaldmann
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
7 @license: GNU GPL, see COPYING for details.
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
8 """
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
9 from MoinMoin.util import pysupport
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
10
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
11 def execute(pagename, request):
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
12 """ Show page charts """
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
13 _ = request.getText
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
14 if not request.user.may.read(pagename):
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
15 request.theme.add_msg(_("You are not allowed to view this page."), "error")
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
16 return request.page.send_page()
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
17
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
18 if not request.cfg.chart_options:
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
19 request.theme.add_msg(_("Charts are not available!"), "error")
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
20 return request.page.send_page()
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
21
4426
8982d8226218 pre-1.9: request.form has qs args and post data, 1.9: .form only post data, .args only qs args, .values both
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 4201
diff changeset
22 chart_type = request.values.get('type', '').strip()
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
23 if not chart_type:
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
24 request.theme.add_msg(_('You need to provide a chart type!'), "error")
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
25 return request.page.send_page()
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
26
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
27 try:
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
28 func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
1805
ebcebba1afb3 removed some unused attributes, used 'dummy' for dummies
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1777
diff changeset
29 except (ImportError, AttributeError):
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
30 request.theme.add_msg(_('Bad chart type "%s"!') % chart_type, "error")
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
Alexander Schremmer <alex AT alexanderweb DOT de>
parents: 1918
diff changeset
31 return request.page.send_page()
1107
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
32
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
33 func(pagename, request)
e866e8975431 move chart code to action/chart.py
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents:
diff changeset
34