changeset 5889:e2754e834244

add a require_comment configuration directive. This allows the comment to be made mandatory, with an appropriate save error when no comment is given.
author Matthijs Kooijman <matthijs@stdin.nl>
date Thu, 20 Sep 2012 17:45:31 +0200
parents d9a35af73a83
children 6d5105a45257
files MoinMoin/action/edit.py MoinMoin/config/multiconfig.py
diffstat 2 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/edit.py	Wed Sep 19 23:40:23 2012 +0200
+++ b/MoinMoin/action/edit.py	Thu Sep 20 17:45:31 2012 +0200
@@ -161,6 +161,8 @@
             from MoinMoin.security.textcha import TextCha
             if not TextCha(request).check_answer_from_form():
                 raise pg.SaveError(_('TextCha: Wrong answer! Go back and try again...'))
+            if request.cfg.require_comment and not comment:
+                raise pg.SaveError(_('Supplying a comment is mandatory. Go back, write a comment and try again...'))
             savemsg = pg.saveText(savetext, rev, trivial=trivial, comment=comment)
         except pg.EditConflict, e:
             msg = e.message
--- a/MoinMoin/config/multiconfig.py	Wed Sep 19 23:40:23 2012 +0200
+++ b/MoinMoin/config/multiconfig.py	Thu Sep 20 17:45:31 2012 +0200
@@ -952,6 +952,7 @@
     ('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
     ('edit_ticketing', True, None),
     ('edit_rows', 20, "Default height of the edit box"),
+    ('require_comment', False, "if True, only allow saving when a comment is filled in"),
 
   )),
   # ==========================================================================