Attachment 'action_template.py'
Download 1 # -*- coding: UTF8 -*-
2 """
3 MoinMoin - ... action
4
5 Allows to ... .
6
7 @copyright: 20??-20?? Autho Name <author@url.org>,
8 @license: GNU GPL, see COPYING for details.
9 """
10
11 from MoinMoin import wikiutil
12 from MoinMoin.Page import Page
13 from MoinMoin.parser.text_moin_wiki import Parser as MoinParser
14
15
16 class Action():
17 def __init__(self, pagename, request):
18 self.request = request
19 self.pagename = self.request.page.page_name
20 self.formatter=self.request.formatter
21 self.page = Page(self.request, self.pagename)
22 self.formatter.page=self.page
23 self.pagepath=self.page.getPageBasePath()[1]
24 self.url=self.request.href(self.request.page.page_name)
25 self.url_full=self.request.getQualifiedURL(self.url)
26 self.title = self.page.split_title()
27 self.formargs=self.request.values
28 def message(self, txt):
29 self.request.theme.add_msg(self.request.getText(txt))
30 return self.page.send_page()
31 def do(self):
32 #
33 if self.formargs.get('message')!=None:
34 return self.message(u"Send a message.\n")
35 else:
36 self.request.setContentLanguage(self.request.lang)
37 self.request.theme.send_title(self.request.getText(u'Action-Template on Page "%s"') % (self.title, ), page=self.page)
38 moin_output="""
39 == Page Information ==
40 * Moin-Pagename: %s
41 * Moin-Pagetitle: %s
42 * Moin-Pagepath: %s
43 * Page-Url: %s
44 * Full Page-Url: %s
45
46 == Url/ Form data ==
47 """%(self.pagename, self.title, self.pagepath, self.url, self.url_full)
48 for key in self.formargs.keys():
49 moin_output+=u" * %s=%s\n"%(key, self.formargs.get(key))
50 moin_output+="== Acl ==\n"
51 if self.request.user.may.read(self.pagename):
52 moin_output+=u" * You have read rights.\n"
53 else:
54 moin_output+=" * You don't have read rights.\n"
55 if self.request.user.may.write(self.pagename):
56 moin_output+=u" * You have write rights.\n"
57 else:
58 moin_output+=u" * You don't have write rights.\n"
59 parser=MoinParser(moin_output, self.request)
60 parser.format(self.formatter)
61 self.request.theme.send_footer(self.pagename)
62 self.request.theme.send_closing_html()
63 return ''
64
65 def execute(pagename, request):
66 return Action(pagename, request).do()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.