Attachment 'redirect.patch.txt'

Download

   1 diff -r 8ab046023ff1 MoinMoin/action/edit.py
   2 --- a/MoinMoin/action/edit.py	Sun Jan 05 04:38:29 2014 +0100
   3 +++ b/MoinMoin/action/edit.py	Fri Jan 31 02:56:37 2014 -0800
   4 @@ -12,8 +12,20 @@
   5  from MoinMoin.Page import Page
   6  from MoinMoin.web.utils import check_surge_protect
   7  
   8 +def redirectSelf(request):
   9 +    request.reset()
  10 +    path = request.environ['PATH_INFO'] + '#'
  11 +    request.http_redirect(request.environ['SCRIPT_NAME']+path)
  12 +
  13  def execute(pagename, request):
  14      """ edit a page """
  15 +
  16 +    # did user hit cancel button?
  17 +    cancelled = 'button_cancel' in request.form
  18 +
  19 +    if cancelled:
  20 +        return redirectSelf(request)
  21 +
  22      _ = request.getText
  23  
  24      if 'button_preview' in request.form and 'button_spellcheck' in request.form:
  25 @@ -76,9 +88,6 @@
  26          pg.sendEditor()
  27          return
  28  
  29 -    # did user hit cancel button?
  30 -    cancelled = 'button_cancel' in request.form
  31 -
  32      from MoinMoin.error import ConvertError
  33      try:
  34          if lasteditor == 'gui':
  35 @@ -182,8 +191,10 @@
  36              pg.sendEditor(preview=savetext, comment=comment, staytop=1)
  37              return
  38  
  39 -        # Send new page after successful save
  40 -        request.reset()
  41 +        # Redirect to new page after successful save
  42 +        # Do not send, or reload will re-post the edit data and be annoying        
  43 +        redirectSelf(request)
  44 +        return
  45          pg = Page(request, pagename)
  46  
  47          # sets revision number to default for further actions

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] (2014-01-31 10:57:00, 1.4 KB) [[attachment:redirect.patch.txt]]
 All files | Selected Files: delete move to page copy to page

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