Back to index

moin  1.9.0~rc2
Functions
MoinMoin.action.chart Namespace Reference

Functions

def execute

Function Documentation

def MoinMoin.action.chart.execute (   pagename,
  request 
)
Show page charts 

Definition at line 11 of file chart.py.

00011 
00012 def execute(pagename, request):
00013     """ Show page charts """
00014     _ = request.getText
00015     if not request.user.may.read(pagename):
00016         request.theme.add_msg(_("You are not allowed to view this page."), "error")
00017         return request.page.send_page()
00018 
00019     if not request.cfg.chart_options:
00020         request.theme.add_msg(_("Charts are not available!"), "error")
00021         return request.page.send_page()
00022 
00023     chart_type = request.values.get('type', '').strip()
00024     if not chart_type:
00025         request.theme.add_msg(_('You need to provide a chart type!'), "error")
00026         return request.page.send_page()
00027 
00028     try:
00029         func = pysupport.importName("MoinMoin.stats.%s" % chart_type, 'draw')
00030     except (ImportError, AttributeError):
00031         request.theme.add_msg(_('Bad chart type "%s"!') % chart_type, "error")
00032         return request.page.send_page()
00033 
00034     func(pagename, request)
00035