On Tue, 21 Aug 2012, Christopher Nelson wrote:

Now and then a ticket validator or some other code I'm not sure of
displays a message at the top of a ticket after I commit changes.  I
want to do that in my plugin but I have no idea what function to use.
Can someone point me at an example?  Thanks!

Like this:

class MyPageValidator(Component):

  implements(IWikiPageManipulator)

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

  def validate_wiki_page(self, req, page):
    if page.name == "MyName":
      if not req.perm.has_permission('WIKI_ADMIN'):
        ... check a lot
          return [(None, "You are not allowed to change this!")]
      try:
        ... check something else
      except Exception, e:
        return [(None, "Data validation failed")]
    return []

Ciao
--
http://www.dstoecker.eu/ (PGP key available)

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

Reply via email to