Attachment 'ShowRev-1.7.py'
Download 1 # -*- coding: iso-8859-1 -*-
2 """
3 ShowRev - action to select a page revision
4 @license: GNU GPL, see COPYING for details.
5 @copyright: 2008 MoinMoin:ReimarBauer
6 """
7 from MoinMoin import wikiutil
8 from MoinMoin.Page import Page
9
10 def form_html(ticket, revlist):
11 html = []
12 for rev in revlist:
13 html.append("<OPTION>%d</OPTION>" % rev)
14 return '''
15 <form method="post" >
16 <p>select a revision</P>
17 <select name="revision" size="%(len)s">
18 %(option)s
19 </select>
20 <input type="hidden" name="action" value="ShowRev">
21 <input type="submit" name="button" value="Select">
22 <input type="hidden" name="ticket" value="%(ticket)s">
23 </form>''' % {
24 'ticket': ticket,
25 'option': ''.join(html),
26 'len': min(len(revlist), 5)}
27
28 def execute(pagename, request):
29 _ = request.getText
30 page = Page(request, pagename)
31 if not request.user.may.read(pagename):
32 msg = _('''You are not allowed to read this page.''')
33 request.theme.add_msg(msg, "error")
34 return page.send_page()
35
36 if (request.form.has_key('button') and request.form.has_key('ticket')):
37 if not wikiutil.checkTicket(request, request.form['ticket'][0]):
38 msg = _('''Please use the interactive user interface!''')
39 request.theme.add_msg(msg, "error")
40 return page.send_page()
41 rev = long((request.form.get('revision', ['-1'])[0]))
42 return Page(request, pagename, rev=rev).send_page()
43 ticket = wikiutil.createTicket(request)
44 revlist = page.getRevList()
45 msg = form_html(ticket, revlist)
46 request.theme.add_msg(msg, "info")
47 page.send_page()
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.