Attachment 'require-comment.diff'

Download

   1 Add a require_comment configuration directive.
   2 
   3 This allows the comment to be made mandatory, with an appropriate save error
   4 when no comment is filled in.
   5 --- a/action/edit.py
   6 +++ b/action/edit.py
   7 @@ -161,6 +161,8 @@
   8              from MoinMoin.security.textcha import TextCha
   9              if not TextCha(request).check_answer_from_form():
  10                  raise pg.SaveError(_('TextCha: Wrong answer! Go back and try again...'))
  11 +            if request.cfg.require_comment and not comment:
  12 +                raise pg.SaveError(_('Supplying a comment is mandatory. Go back, write a comment and try again...'))
  13              savemsg = pg.saveText(savetext, rev, trivial=trivial, comment=comment)
  14          except pg.EditConflict, e:
  15              msg = e.message
  16 --- a/config/multiconfig.py
  17 +++ b/config/multiconfig.py
  18 @@ -954,6 +954,7 @@
  19      ('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
  20      ('edit_ticketing', True, None),
  21      ('edit_rows', 20, "Default height of the edit box"),
  22 +    ('require_comment', False, "if True, only allow saving when a comment is filled in"),
  23  
  24    )),
  25    # ==========================================================================

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] (2012-04-17 13:19:40, 1.8 KB) [[attachment:form-on-save-error.diff]]
  • [get | view] (2012-04-17 13:19:26, 1.2 KB) [[attachment:require-comment.diff]]
 All files | Selected Files: delete move to page copy to page

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