changeset 1107:e866e8975431

move chart code to action/chart.py
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 31 Jul 2006 00:42:41 +0200
parents 62f28a891ede
children a544d343324e
files MoinMoin/action/__init__.py MoinMoin/action/chart.py
diffstat 2 files changed, 34 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/__init__.py	Mon Jul 31 00:29:49 2006 +0200
+++ b/MoinMoin/action/__init__.py	Mon Jul 31 00:42:41 2006 +0200
@@ -315,30 +315,6 @@
 ### Special Actions
 #############################################################################
 
-def do_chart(pagename, request):
-    """ Show page charts """
-    _ = request.getText
-    if not request.user.may.read(pagename):
-        msg = _("You are not allowed to view this page.")
-        return request.page.send_page(request, msg=msg)
-
-    if not request.cfg.chart_options:
-        msg = _("Charts are not available!")
-        return request.page.send_page(request, msg=msg)
-
-    chart_type = request.form.get('type', [''])[0].strip()
-    if not chart_type:
-        msg = _('You need to provide a chart type!')
-        return request.page.send_page(request, msg=msg)
-
-    try:
-        func = pysupport.importName("MoinMoin.stats." + chart_type, 'draw')
-    except (ImportError, AttributeError):
-        msg = _('Bad chart type "%s"!') % chart_type
-        return request.page.send_page(request, msg=msg)
-
-    func(pagename, request)
-
 def do_dumpform(pagename, request):
     """ dump the form data we received in this request for debugging """
     data = util.dumpFormData(request.form)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/action/chart.py	Mon Jul 31 00:42:41 2006 +0200
@@ -0,0 +1,34 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - show some statistics chart
+
+    @copyright: 2000-2004 by Jürgen Hermann <jh@web.de>,
+                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 request.user.may.read(pagename):
+        msg = _("You are not allowed to view this page.")
+        return request.page.send_page(request, msg=msg)
+
+    if not request.cfg.chart_options:
+        msg = _("Charts are not available!")
+        return request.page.send_page(request, msg=msg)
+
+    chart_type = request.form.get('type', [''])[0].strip()
+    if not chart_type:
+        msg = _('You need to provide a chart type!')
+        return request.page.send_page(request, msg=msg)
+
+    try:
+        func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
+    except (ImportError, AttributeError), err:
+        msg = _('Bad chart type "%s"!') % chart_type
+        return request.page.send_page(request, msg=msg)
+
+    func(pagename, request)
+