Back to index

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

Functions

def execute

Function Documentation

def MoinMoin.action.supplementation.execute (   pagename,
  request 
)

Definition at line 14 of file supplementation.py.

00014 
00015 def execute(pagename, request):
00016     _ = request.getText
00017     sub_page_name = request.cfg.supplementation_page_name
00018     sub_page_template = request.cfg.supplementation_page_template
00019     newpagename = "%s/%s" % (pagename, sub_page_name)
00020     errormsg = _("You are not allowed to create the supplementation page.")
00021 
00022     if pagename.endswith(sub_page_name): # sub_sub_page redirects to sub_page
00023         query = {}
00024         url = Page(request, pagename).url(request, query)
00025         request.http_redirect(url)
00026     elif request.user.may.read(newpagename):
00027         query = {}
00028         url = Page(request, newpagename).url(request, query)
00029         test = Page(request, newpagename)
00030         if test.exists(): # page is defined -> redirect
00031             request.http_redirect(url)
00032         elif request.user.may.write(newpagename):  # page will be created from template
00033             query = {'action': 'edit', 'backto': newpagename, 'template': quoteWikinameURL(sub_page_template)}
00034             url = Page(request, newpagename).url(request, query)
00035             request.http_redirect(url)
00036         else:
00037             request.theme.add_msg(errormsg, "error")
00038     else:
00039         request.theme.add_msg(errormsg, "error")
00040 

Here is the call graph for this function: