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.
  • [get | view] (2008-03-22 00:13:47, 61.4 KB) [[attachment:MoinMoinArchitecture.png]]
  • [get | view] (2008-03-22 13:57:23, 7.3 KB) [[attachment:ShowCSV.png]]
  • [get | view] (2008-03-22 15:48:45, 1.6 KB) [[attachment:ShowRev-1.7.py]]
  • [get | view] (2009-11-07 20:10:06, 106.2 KB) [[attachment:StartSeite.png]]
  • [get | view] (2008-03-22 00:34:35, 120.4 KB) [[attachment:classic_dark.jpg]]
  • [get | view] (2008-03-22 00:13:47, 94.4 KB) [[attachment:exampletheme.png]]
  • [get | view] (2008-03-22 00:13:47, 66.2 KB) [[attachment:explorer_theme.png]]
  • [get | view] (2008-03-22 00:13:47, 32.7 KB) [[attachment:greenmist.png]]
  • [get | view] (2008-03-22 15:40:13, 1.3 KB) [[attachment:log-1.7.py]]
  • [get | view] (2008-03-22 00:13:47, 134.7 KB) [[attachment:moose.png]]
  • [get | view] (2009-08-23 14:54:46, 685.5 KB) [[attachment:package.zip]]
  • [get | view] (2008-03-22 00:13:47, 106.7 KB) [[attachment:simplemente-chico.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.