Attachment 'log-1.7.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 """
   3     log - add log entry
   4     @license: GNU GPL, see COPYING for details.
   5     @copyright:  2007 MoinMoin:ReimarBauer
   6 """
   7 from MoinMoin import wikiutil
   8 from MoinMoin.PageEditor import PageEditor
   9 from MoinMoin.Page import Page
  10 
  11 def execute(pagename, request):
  12     _ = request.getText
  13     ticket = 'Geheim!'
  14     esc = wikiutil.escape
  15     date = esc(request.form.get('date', ['None'])[0])
  16     comment = esc(request.form.get('comment', ['None'])[0])
  17     secret = esc(request.form.get('ticket', ['wrong'])[0])
  18 
  19     if (ticket != secret or  date == 'None' or
  20         comment == 'None'):
  21         msg = _(u"A severe error occured:")
  22         request.theme.add_msg(msg, "error")
  23         Page(request, pagename).send_page()
  24         return
  25 
  26     pagename = u'LogPage'
  27     page = Page(request, pagename)
  28     raw = u''
  29 
  30     if page.exists():
  31         raw = page.get_raw_body()
  32 
  33     result = "|| %s || %s ||" % (date, comment)
  34     newtext = "%s%s\n" % (raw, result)
  35     try:
  36         PageEditor(request, pagename).saveText(newtext, 0)
  37         msg = u"OK!"
  38         request.theme.add_msg(msg, "info")
  39         Page(request, pagename).send_page()
  40     except:
  41         msg = _(u"A severe error occured:")
  42         request.theme.add_msg(msg, "error")
  43         Page(request, pagename).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.