Attachment 'form-on-save-error.diff'
Download 1 On a save error, show the editor again and mark the error.
2
3 Previously, the (unsaved) page would be shown again, with a small message with
4 class="info" at the top. It is easy to miss the save error like this,
5 especially since you get the page again instead of the editor. Also, browsers
6 might not always preserve your editor contents after pressing the back button.
7
8 With this patch, the error is clearly marked using the "error" message class.
9 Also, the editor is shown again, so you can fix the error right away.
10
11 Note: This patch does not yet seem to preserve the edited text on newly
12 created pages.
13 --- a/action/edit.py
14 +++ b/action/edit.py
15 @@ -162,7 +162,7 @@
16 if not TextCha(request).check_answer_from_form():
17 raise pg.SaveError(_('TextCha: Wrong answer! Go back and try again...'))
18 if request.cfg.require_comment and not comment:
19 - raise pg.SaveError(_('Supplying a comment is mandatory. Go back, write a comment and try again...'))
20 + raise pg.SaveError(_('Supplying a comment is mandatory. Write a comment below and try again...'))
21 savemsg = pg.saveText(savetext, rev, trivial=trivial, comment=comment)
22 except pg.EditConflict, e:
23 msg = e.message
24 @@ -176,8 +176,13 @@
25 return
26
27 except pg.SaveError, msg:
28 + # Make sure the new text is put into the editor again
29 + pg.set_raw_body(savetext, modified=1)
30 # msg contains a unicode string
31 - savemsg = unicode(msg)
32 + request.theme.add_msg(unicode(msg), "error")
33 + # Show the editor again
34 + pg.sendEditor(comment=comment)
35 + return
36
37 # Send new page after save or after unsuccessful conflict merge.
38 request.reset()
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.