On Mon, May 5, 2008 at 4:53 PM, Joel Nimety <[EMAIL PROTECTED]> wrote:
>
>  Is it possible to force adding comments when editing a wiki page instead
>  of having comments optional?  Is this possible via the plugin
>  architecture?  Thanks.
>

I'm using a very simple implementation of this using
IWikiPageManipulator that looks something like this (this is a
stripped down version):

from trac.core import *
from trac.wiki.api import IWikiPageManipulator

class MyWikiValidator(Component):
    implements(IWikiPageManipulator)

    def prepare_wiki_page(self, req, page, fields):
        pass

    def validate_wiki_page(self, req, page):
        if not req.args.get('comment'):
            yield ('comment', 'You must enter a comment when modifying
a wiki page.')

This works better with my patch in #5992:
http://trac.edgewall.org/ticket/5992 which will cause it to return to
the editor and display a warning, rather than throw an exception.
Note that the patch is somewhat out of date, as the req.warning()
calls need to be replaced with add_warning(req, ...)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to